A schema describing the shape of the output JSON. The schema is not used to map documents, but in the Mappings UI, you can only write mapping expressions for fields that are present in the target schema.

The schema can include a default document. When mapping_type is set to merge_with_target_example, the values in this document are used as defaults, i.e. if a mapping expressions doesn't produce a value for a given field, the default value is used. For the mapping type merge_with_target_example, providing a target schema with a default document is mandatory. For all other mapping types, the default document is ignored and the entire target schema is optional.

If you don't plan on editing the mapping definition using the UI, and you're using a mapping type other than merge_with_target_example, there's no benefit to including a target schema.

Hierarchy

  • MappingTarget

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.