(
schema: Constraint,
options?: ToJsonSchemaOptions
): JsonSchema.Document<"draft-2020-12">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.
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.
export function function toJsonSchemaDocument(
schema: Constraint,
options?: ToJsonSchemaOptions
): JsonSchema.Document<"draft-2020-12">
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.
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.
toJsonSchemaDocument(
schema: Constraint(parameter) schema: {
ast: SchemaAST.AST;
Type: unknown;
Encoded: unknown;
DecodingServices: unknown;
EncodingServices: unknown;
Iso: unknown;
}
schema: Constraint,
options: ToJsonSchemaOptionsoptions?: ToJsonSchemaOptions
): import JsonSchemaJsonSchema.type JsonSchema.Document = /*unresolved*/ anyDocument<"draft-2020-12"> {
const const sd: SchemaRepresentation.Documentconst sd: {
representation: Representation;
references: References;
}
sd = function toRepresentation(
schema: Constraint
): SchemaRepresentation.Document
Derives an intermediate SchemaRepresentation.Document from a schema. This
document is used internally by
toJsonSchemaDocument
and related
functions to produce JSON Schema output.
toRepresentation(schema: Constraint(parameter) schema: {
ast: SchemaAST.AST;
Type: unknown;
Encoded: unknown;
DecodingServices: unknown;
EncodingServices: unknown;
Iso: unknown;
}
schema)
const const jd: JsonSchema.Document<"draft-2020-12">const jd: {
dialect: D;
schema: JsonSchema;
definitions: Definitions;
}
jd = import InternalStandardInternalStandard.function toJsonSchemaDocument(
document: SchemaRepresentation.Document,
options?: Schema.ToJsonSchemaOptions
): JsonSchema.Document<"draft-2020-12">
toJsonSchemaDocument(const sd: SchemaRepresentation.Documentconst sd: {
representation: Representation;
references: References;
}
sd, options: ToJsonSchemaOptionsoptions)
return {
dialect: stringdialect: "draft-2020-12",
schema: JsonSchema.JsonSchemaschema: const jd: JsonSchema.Document<"draft-2020-12">const jd: {
dialect: D;
schema: JsonSchema;
definitions: Definitions;
}
jd.schema,
definitions: JsonSchema.Definitionsdefinitions: const jd: JsonSchema.Document<"draft-2020-12">const jd: {
dialect: D;
schema: JsonSchema;
definitions: Definitions;
}
jd.definitions
}
}