Header menu logo CodecMapper

JsonSchema Module

JSON Schema export for the JSON wire shape described by `Schema<'T>`. This exports the structural JSON contract implied by the schema. Mapping wrappers such as `Schema.map` and `Schema.tryMap` contribute the underlying wire shape, while field-policy wrappers affect whether object properties are listed as required.

Types and nested modules

Type/Module Description

ImportOptions (Module)

Helpers for building JSON Schema import options.

FormatValidator

Validates a JSON Schema `format` string against domain-specific rules.

ImportOptions (Type)

Options for JSON Schema import. Import stays structural by default, but callers can opt into extra string-format checks by registering validators for specific `format` names.

ImportReport

Describes the outcome of importing a JSON Schema into `Schema`. The imported schema always decodes through the raw JSON DOM fallback. These diagnostics explain which keywords were actively enforced and which keywords caused the importer to stay on the raw-fallback path.

Functions and values

Function or value Description

generate schema

Full Usage: generate schema

Parameters:
Returns: string

Generates a compact JSON Schema document for the JSON wire shape of a schema. The exported schema describes the JSON contract only. XML-specific shape details and business-rule semantics inside mapping functions are not representable here and therefore export as the underlying wire form.

schema : Schema<'T>
Returns: string

import jsonSchemaText

Full Usage: import jsonSchemaText

Parameters:
    jsonSchemaText : string

Returns: Schema<JsonValue>

Imports the deterministic JSON Schema subset into a JSON-only `Schema`. This uses the built-in format validator set. Use `importUsing` when you need project-specific `format` validation behavior.

jsonSchemaText : string
Returns: Schema<JsonValue>

importUsing options jsonSchemaText

Full Usage: importUsing options jsonSchemaText

Parameters:
Returns: Schema<JsonValue>

Imports the deterministic JSON Schema subset into a JSON-only `Schema`. This is the convenience entrypoint when you only need the imported schema itself. Use `importWithReport` when you also need diagnostics about which keywords were enforced or left on the raw-fallback path.

options : ImportOptions
jsonSchemaText : string
Returns: Schema<JsonValue>

importWithReport jsonSchemaText

Full Usage: importWithReport jsonSchemaText

Parameters:
    jsonSchemaText : string

Returns: ImportReport

Imports JSON Schema into `Schema` and returns diagnostics. This uses the built-in format validator set. Use `importWithReportUsing` when you need project-specific `format` rules.

jsonSchemaText : string
Returns: ImportReport

importWithReportUsing options jsonSchemaText

Full Usage: importWithReportUsing options jsonSchemaText

Parameters:
Returns: ImportReport

Imports the deterministic JSON Schema subset into a JSON-only `Schema`. The imported schema keeps the original JSON shape by decoding through `Schema.jsonValue` first, then applying the supported JSON Schema rules as structural refinement over the raw DOM. Unsupported branch-shaping features currently fall back to the unconstrained raw JSON schema.

options : ImportOptions
jsonSchemaText : string
Returns: ImportReport

Type something to start searching.