effect-io-ai

Package: effect
Module: Schema

Schema.toJsonSchemaDocument

Returns a JSON Schema document using draft 2020-12.

Details

The options parameter controls generation details such as additional properties and synthesized check descriptions; it does not change the draft target. Declarations are lowered through their toCodecJson or toCodec annotation when available before the representation document is compiled.

Gotchas

JSON Schema generation is best-effort. Some Effect schema semantics cannot be represented exactly in JSON Schema, and importing an emitted JSON Schema may produce an equivalent approximation rather than the original schema shape. Opaque declarations without a structural codec are represented by an unconstrained JSON Schema.

Signature

declare const toJsonSchemaDocument: (schema: Constraint, options?: ToJsonSchemaOptions) => JsonSchema.Document<"draft-2020-12">

Source

Since v4.0.0