ADK for TypeScript: API Reference
    Preparing search index...

    Function genaiSchemaToJsonSchema

    • 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.

      Parameters

      • schema: Schema

      Returns Record<string, unknown>