Skip to main content

LaunchFormJsonToLiterals

LaunchFormJsonToLiterals converts an RSJF JSON schema to a list of NamedLiterals.

def LaunchFormJsonToLiterals(
ctx: context.Context,
jsonSchema: *structpb.Struct
) - > []*task.NamedLiteral

Converts an RSJF JSON schema to a list of NamedLiterals. This function is used to extract default values and types from a JSON schema definition, typically for populating form fields or defining task inputs.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for logging and cancellation.
jsonSchema*structpb.StructThe RSJF JSON schema as a structpb.Struct from which to extract named literals. This schema defines the structure and default values of the form fields.

Returns

TypeDescription
[]*task.NamedLiteralA slice of NamedLiteral objects, where each object represents a field from the JSON schema with its name and a Literal value derived from its default. Returns an error if the schema is invalid or conversion fails.