數字
數字欄位由type: number
表示,沒有其他必要屬性。
"sampleField": {
"title": "Sample Number Field",
"description": "An example number field.",
"type": "number"
}
整數
整數欄位由type: integer
表示,沒有其他必要欄位。
"sampleField": {
"title": "Sample Integer Field",
"description": "An example integer field.",
"type": "integer"
}
您可以將minimum
和maximum
屬性新增至定義,選擇性地限制整數的範圍。 結構描述產生器UI支援的其他數位型別只有integer
個具有特定minimum
和maximum
限制條件的型別,例如Long、Short和Byte。
"sampleField": {
"title": "Sample Integer Field",
"description": "An example integer field with added constraints.",
"type": "integer",
"minimum": 1,
"maximum": 100
}
長
與透過結構描述產生器UI建立的Long欄位等同的是integer
型別欄位,具有特定minimum
和maximum
值(分別為-9007199254740992
和9007199254740992
)。
"sampleField": {
"title": "Sample Long Field",
"description": "An example long field.",
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740992
}
短整數
與透過結構描述產生器UI建立的Short欄位等同的是integer
型別欄位,具有特定minimum
和maximum
值(分別為-32768
和32768
)。
"sampleField": {
"title": "Sample Short Field",
"description": "An example short field.",
"type": "integer",
"minimum": -32768,
"maximum": 32768
}
位元組
與透過結構描述產生器UI建立的位元組欄位相當的是integer
型別欄位,具有特定的minimum
和maximum
值(分別為-128
和128
)。
"sampleField": {
"title": "Sample Byte Field",
"description": "An example byte field.",
"type": "integer",
"minimum": -128,
"maximum": 128
}
布林值
布林值欄位由type: boolean
表示。
"sampleField": {
"title": "Sample Boolean Field",
"description": "An example boolean field.",
"type": "boolean"
}
您可以選擇提供當擷取期間未提供明確值時,欄位將使用的default
值。
"sampleField": {
"title": "Sample Boolean Field",
"description": "An example boolean field with a default value.",
"type": "boolean",
"default": false
}
default
值,且布林欄位設定為required
,則擷取時,任何遺失此欄位可接受值的記錄都將無法驗證。日期
日期欄位由type: string
和format: date
表示。 您也可選擇提供examples
陣列,以便在您想要為手動輸入資料的使用者顯示範例日期字串時運用。
"sampleField": {
"title": "Sample Date Field",
"description": "An example date field with an example array item.",
"type": "string",
"format": "date",
"examples": ["2004-10-23"]
}
日期時間
日期時間欄位由type: string
和format: date-time
表示。 您也可以選擇提供examples
陣列,以便在您要顯示手動輸入資料之使用者的範例日期時間字串時運用。
"sampleField": {
"title": "Sample Datetime Field",
"description": "An example datetime field with an example array item.",
"type": "string",
"format": "date-time",
"examples": ["2004-10-23T12:00:00-06:00"]
}
陣列
陣列欄位由type: array
和items
物件表示,該物件定義陣列將接受的專案結構描述。
您可以使用基本型別(例如字串陣列)來定義陣列專案:
"sampleField": {
"title": "Sample Array Field",
"description": "An example array field using a primitive type.",
"type": "array",
"items": {
"type": "string"
}
}
您也可以透過$ref
屬性參照資料型別的$id
,根據現有的資料型別定義陣列專案。 下列是付款專案物件的陣列:
"sampleField": {
"title": "Sample Array Field",
"description": "An example array field using a data type reference.",
"type": "array",
"items": {
"$ref": "https://ns.adobe.com/xdm/data/paymentitem"
}
}
物件
物件欄位由type: object
和定義結構描述欄位子屬性的properties
物件表示。
在properties
下定義的每個子欄位都可以使用任何基本值type
來定義,或是透過指向相關資料型別$id
的$ref
屬性來參考現有的資料型別:
"sampleField": {
"title": "Sample Object Field",
"description": "An example object field.",
"type": "object",
"properties": {
"field1": {
"type": "string"
},
"field2": {
"$ref": "https://ns.adobe.com/xdm/common/measure"
}
}
}
您也可以透過參考資料型別來定義整個物件,前提是相關資料型別本身定義為type: object
:
"sampleField": {
"title": "Sample Object Field",
"description": "An example object field using a data type reference.",
"$ref": "https://ns.adobe.com/xdm/common/phoneinteraction"
}
地圖
對應欄位基本上是object
型別的欄位,其索引鍵集不受限制。 如同物件,對應有type
值object
,但其meta:xdmType
已明確設定為map
。
對應 不得 定義任何屬性。 它 必須 定義單一additionalProperties
結構描述以說明對應中包含的值型別(每個對應只能包含單一資料型別)。 type
值必須是string
或integer
。
例如,具有字串型別值的對應欄位會定義如下:
"sampleField": {
"title": "Sample Map Field",
"description": "An example map field.",
"type": "object",
"meta:xdmType": "map",
"additionalProperties": {
"type": "string"
}
}
如需建立自訂對應欄位的詳細資訊,請參閱下節。
建立自訂地圖型別
為了在XDM中有效支援「類似對應」資料,物件可能會被設為map
的meta:xdmType
註釋,以明確表示物件應像金鑰集未受限制一樣受到管理。 擷取至對應欄位的資料必須使用字串鍵,而且只能使用字串或整數值(由additionalProperties.type
決定)。
XDM對於此儲存提示的使用會設定下列限制:
- 對應型別必須屬於型別
object
。 - 對應型別不得有已定義的屬性(換言之,它們會定義「空白」物件)。
- 對應型別必須包含
additionalProperties.type
欄位,描述可能放置在對應中的值:string
或integer
。
請確定您只在絕對必要時才使用對應型別欄位,因為這些欄位具有下列效能缺陷:
- 來自Adobe Experience Platform查詢服務的回應時間,1億筆記錄會從3秒降低到10秒。
- 地圖必須少於16個索引鍵,否則可能會進一步降低。
Experience Platform使用者介面在擷取對應型別欄位索引鍵的方式上也有限制。 雖然物件型別欄位可以展開,但地圖會顯示為單一欄位。