Interface JSONSchemaOptions

interface JSONSchemaOptions {
    basePath?: string;
    constAsEnum?: boolean;
    definitions?: Dict<AnyShape>;
    definitionsKey?: string;
    dialect?: string;
    postprocess?: ((shape: AnyShape, schema: JSONSchema) => void);
    unusedDefinitions?: boolean;
}

Properties

basePath?: string

The schema base path.

"#"
constAsEnum?: boolean

If true then JSONSchema.const is rendered as JSONSchema.enum with a single element.

definitions?: Dict<AnyShape>

The mapping from the definition name to a shape that is converted to the JSON schema.

definitionsKey?: string

The key under which the definitions are stored.

"definitions"
dialect?: string

The schema dialect placed in JSONSchema.$schema. By default, no dialect is added.

"https://json-schema.org/draft/2020-12/schema"
postprocess?: ((shape: AnyShape, schema: JSONSchema) => void)

Called for each schema after it is generated.

unusedDefinitions?: boolean

If true then definitions from definitions that aren't referenced, are still rendered under definitionsKey. Otherwise, those definitions aren't rendered.