GeezerVison is showing adk.dev — genaiSchemaToJsonSchema | ADK for TypeScript: API Reference - v2.5.0
Function genaiSchemaToJsonSchema
-
genaiSchemaToJsonSchema(schema: Schema): Record<string, unknown>
Converts a genai Schema into a standard JSON Schema object.
This is the inverse of zodObjectToSchema, which renders Zod into the
genai/OpenAPI dialect. The two dialects differ in four ways, all handled
here:
type is an uppercase enum (STRING) rather than a JSON Schema type name
(string). TYPE_UNSPECIFIED means "no constraint" and is dropped.
nullable: true widens the type, which JSON Schema expresses as a type
union (['string', 'null']).
- Count and length bounds are stringified (
maxItems: '5').
propertyOrdering and example have no JSON Schema equivalent.
Everything else (description, title, default, pattern, required,
minimum, maximum, format) is already JSON-Schema-shaped and passes
through, with items, properties and anyOf converted recursively.
Returns Record<string, unknown>