Define XDM fields in the Schema Registry API

🔗 The Schema Registry API allows you to define custom fields in your schemas through the use of formats and optional constraints. meta:xdmType

NOTA

meta:xdmType🔗 string integer

The following table outlines the appropriate formatting to define different field types, including those with optional properties. 🔗

🔗 🔗

XDM type Optional properties Esempio
String
  • pattern
  • minLength
  • maxLength
"sampleField": {
    "type": "string",
    "pattern": "^[A-Z]{2}$",
    "maxLength": 2
}
URI
"sampleField": {
  "type": "string",
  "format": "uri"
}
Enum
  • default
  • meta:enum
enummeta:enum
"sampleField": {
  "type": "string",
  "enum": [
      "value1",
      "value2",
      "value3"
  ],
  "meta:enum": {
      "value1": "Value 1",
      "value2": "Value 2",
      "value3": "Value 3"
  },
  "default": "value1"
}

meta:enum meta:enumenum meta:enumenum
Number
"sampleField": {
  "type": "number"
}
Long
"sampleField": {
  "type": "integer",
  "minimum": -9007199254740992,
  "maximum": 9007199254740992
}
Integer
"sampleField": {
  "type": "integer",
  "minimum": -2147483648,
  "maximum": 2147483648
}
Short
"sampleField": {
  "type": "integer",
  "minimum": -32768,
  "maximum": 32768
}
Byte
"sampleField": {
  "type": "integer",
  "minimum": -128,
  "maximum": 128
  }
Boolean
  • default
"sampleField": {
  "type": "boolean",
  "default": false
}
Date
"sampleField": {
  "type": "string",
  "format": "date",
  "examples": ["2004-10-23"]
}
DateTime
:00:
Array An array of basic scalar types (e.g. strings):
"sampleField": {
  "type": "array",
  "items": {
    "type": "string"
  }
}

"sampleField": {
  "type": "array",
  "items": {
    "$ref": "https://ns.adobe.com/xdm/data/paymentitem"
  }
}
Object typeproperties
"sampleField": {
  "type": "object",
  "properties": {
    "field1": {
      "type": "string"
    },
    "field2": {
      "type": "number"
    }
  }
}
$id
"sampleField": {
  "type": "object",
  "$ref": "https://ns.adobe.com/xdm/common/phoneinteraction"
}
Map A map-type field is essentially an object-type field with an unconstrained set of keys. typeobjectmeta:xdmTypemap

additionalProperties typestringinteger

"sampleField": {
  "type": "object",
  "meta:xdmType": "map",
  "additionalProperties":{
    "type": "string"
  }
}
See the section below for more information on creating custom map types in XDM.

Creating custom map types

meta:xdmType map additionalProperties.type

XDM places the following restrictions on the use of this storage hint:

  • object
  • Map types MUST NOT have properties defined (in other words, they define "empty" objects).
  • additionalProperties.type string integer

Ensure that you are only using map-type fields when absolutely necessary, as they carry the following performance drawbacks:

  • Response time from Adobe Experience Platform Query Service degrades from three seconds to ten seconds for 100 million records.
  • Maps must have fewer than 16 keys or else risk further degradation.

The Platform user interface also has limitations in how it can extract the keys of map-type fields. Whereas object-type fields can be expanded, maps are displayed as a single field instead.

Passaggi successivi

This guide covered how to define different field types in the API. 🔗

In questa pagina