Setu-TS
    Preparing search index...

    Class ZodToOpenApi

    Converts a Zod schema to an OpenAPI 3.1 schema object.

    Zod >=4.6.6 <5 is supported, detected by its public toJSONSchema method. An unrecognized schema, including a legacy Zod v3 schema, degrades to {} — never a throw — and, when a diagnostics channel is attached, reports what it could not represent.

    0.1.0

    Index
    • Creates a transformer.

      Parameters

      • OptionalonSchema: SchemaNodeHook

        Optional hook consulted for every schema node, so a caller can substitute a $ref for a reused schema at ANY depth rather than only at the root. Omit it for a plain transform.

      • Optionalchannels: {
            onDefinition?: (name: string, schema: OpenApiSchemaObject) => void;
            onDefinitionClaim?: (hint: string) => string;
            onUnrepresentable?: (diagnostic: { reason: string }) => void;
        }

        Optional outbound channels for zod v4 $defs and unrepresentable-node diagnostics. Entirely optional: without them the zod v4 path still produces a complete, self-contained schema.

      Returns ZodToOpenApi