Package com.google.genkit.prompt
Class Picoschema
java.lang.Object
com.google.genkit.prompt.Picoschema
Converts Picoschema (the compact schema dialect used in
.prompt frontmatter) into
standard JSON Schema.
Picoschema is a shorthand for describing an object's fields. Given a YAML block already parsed
into Java objects, this converter produces a JSON-Schema Map suitable for the Dev UI and
generic action runners.
Supported syntax:
- Scalar fields:
fieldName: string(types: string, boolean, null, number, integer, any). - Descriptions:
fieldName: string, a human description— text after the first comma. - Optional fields:
fieldName?: string— excluded fromrequired. - Wrappers:
items(array): string,obj(object): {...},color(enum): [RED, GREEN]. A comma in the parenthetical adds a description, e.g.tags(array, list of tags): string. - Nested objects: a field whose value is a map is treated as a nested object.
This is a pragmatic implementation covering the common cases; if a value already looks like a
full JSON Schema (has a JSON-schema type plus properties/items/
$schema) it is passed through unchanged.
-
Method Summary
-
Method Details
-
convert
Converts a parsed Picoschema definition into a JSON Schema map.- Parameters:
pico- the Picoschema value (map, string, or null)- Returns:
- the JSON schema as a map, or
nullifpicois null
-