JSON Schema Resolver

implproposal

Derive schema definitions from external JSON schema files.

Scope

When this extension is enabled schema references can point to JSON schema files in addition to local fragments. The reference can be either a URL or a relative path to a file in resources/schemas. It also supports referencing sub-schemas in $defs. Examples:

  • https://example.com/buildings.json
  • https://example.com/buildings.json#/$defs/address
  • buildings.json
  • buildings.json#/$defs/address

Limitations

Compositions are only supported to some extent:

  • oneOf Only the first variant is used.
  • anyOf Only the first variant is used.
  • allOf The first variant is used as main schema. Properties from additional variants are merged into the main schema.

Configuration

Options

NameDefaultDescriptionTypeSince
enabled
false
Enable the extension?
boolean
v2.0
objectTypeRefs
{}
Allows to map JSON schema definitions to an objectType, e.g. '#/$defs/Link': Link.
object
v3.4
geometryTypeRefs
{}
Allows to map JSON schema definitions to a geometryType, e.g. https://geojson.org/schema/LineString.json': LINE_STRING.
object
v3.4
relationRefs
{}
Allows to map JSON schema definitions to a refType, e.g. '#/$defs/Address': address.
object
v3.4
compositionIndexes
0
Allows to choose a specific variant for oneOf/anyOf/allOf.
object
v3.4

Example


- type: JSON_SCHEMA
  enabled: true
  objectTypeRefs:
    '#/$defs/Link': Link