A schema describing the shape of the input JSON. The schema is not used to map documents, but it can provide valuable assistance while writing mapping expressions in the Mappings UI. The schema can include a default document with values that, also, can be helpful while writing mapping expressions. If you don't plan on editing the mapping definition using the UI, there's no benefit to including a source schema.

Hierarchy

  • MappingSource

Properties

A description of sources from which the document is derived.

content: undefined | string

A JSON Schema. The schema must contain a default field that has an example of a document that conforms to the schema, otherwise the schema Mappings UI won’t be able to use the schema. For example:

\{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": \{
"quantity": \{
"type": "number"
\},
"unit_price": \{
"type": "number"
\},
"currency": \{
"type": "string",
"minLength": 3,
"maxLength": 3
\}
\},
"default": \{
"quantity": 1,
"unit_price": 1.00,
"currency": "USD"
\}
\}

The schema must be provided as a string, so in practice, it doesn't look like the above; it looks like this:

"\{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":\{"quantity":\{"type":"number"\},"unit_price":\{"type":"number"\},"currency":\{"type":"string","minLength":3,"maxLength":3\}\},"default":\{"quantity":1,"unit_price":1,"currency":"USD"\}\}"
name?: string

Deprecated

The name of the schema.

type: undefined | string

Specifies the format of the schema. Only JSON Schema is supported, so this must be set to jsonschema@2020-12.