JSON 重复对象的架构数组
JSON schema array of repetitive object
我需要帮助来构建 JSON 模式,其中任务 属性 是对象类型。包含数组类型的"development"、"review"、"production" & "distribution"四个部门。每个部门都有重复的任务详细信息对象,如下所示。
那么我如何为这些数据定义 JSON 架构?
注意:
部门不应包含其他类型数据
"taks": {
"development":[
{
"description": "",
"assigned_to":"Cortney.Brown",
"start_date": "8-28-2019",
"end_date": "9-15-2019",
"status":"wip",
"priority":"normal",
},
{
"description": "",
"assigned_to":"Renfred.Rogers",
"start_date": "8-29-2019",
"end_date": "9-10-2019",
"status":"complete",
"priority":"high",
}
],
"review": [
{
"description": "",
"assigned_to":"Herring.Myers",
"start_date": "8-30-2019",
"end_date": "9-5-2019",
"status":"OnHold",
"priority":"low",
},
{
"description": "",
"assigned_to":"Dimos.Gomez",
"start_date": "9-2-2019",
"end_date": "9-12-2019",
"status":"wip",
"priority":"normal",
}
],
"production": [
{
"description": "",
"assigned_to":"Ridge.Lopez",
"start_date": "9-5-2019",
"end_date": "9-15-2019",
"status":"wip",
"priority":"normal",
},
{
"description": "",
"assigned_to":"Keyon.Hill",
"start_date": "9-7-2019",
"end_date": "9-13-2019",
"status":"OnHold",
"priority":"low",
},
{
"description": "",
"assigned_to":"Bennett.Sanchez",
"start_date": "9-10-2019",
"end_date": "9-20-2019",
"status":"complete",
"priority":"low",
}
],
"distribution": [
{
"description": "",
"assigned_to":"Kemen.Adams",
"start_date": "9-12-2019",
"end_date": "9-20-2019",
"status":"complete",
"priority":"high",
}
]
}
从我看到的是这样的:
{
"type": "object",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "JSON schema generated with JSONBuddy https://www.json-buddy.com",
"properties": {
"taks": {
"$ref": "#/definitions/taks"
}
},
"definitions": {
"an_item": {
"type": "object",
"additionalProperties": false,
"properties": {
"assigned_to": {
"type": "string"
},
"description": {
"type": "string"
},
"end_date": {
"type": "string"
},
"priority": {
"type": "string"
},
"start_date": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"taks": {
"type": "object",
"properties": {
"development": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
},
"distribution": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
},
"production": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
},
"review": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
}
}
}
}
}
我需要帮助来构建 JSON 模式,其中任务 属性 是对象类型。包含数组类型的"development"、"review"、"production" & "distribution"四个部门。每个部门都有重复的任务详细信息对象,如下所示。
那么我如何为这些数据定义 JSON 架构?
注意: 部门不应包含其他类型数据
"taks": {
"development":[
{
"description": "",
"assigned_to":"Cortney.Brown",
"start_date": "8-28-2019",
"end_date": "9-15-2019",
"status":"wip",
"priority":"normal",
},
{
"description": "",
"assigned_to":"Renfred.Rogers",
"start_date": "8-29-2019",
"end_date": "9-10-2019",
"status":"complete",
"priority":"high",
}
],
"review": [
{
"description": "",
"assigned_to":"Herring.Myers",
"start_date": "8-30-2019",
"end_date": "9-5-2019",
"status":"OnHold",
"priority":"low",
},
{
"description": "",
"assigned_to":"Dimos.Gomez",
"start_date": "9-2-2019",
"end_date": "9-12-2019",
"status":"wip",
"priority":"normal",
}
],
"production": [
{
"description": "",
"assigned_to":"Ridge.Lopez",
"start_date": "9-5-2019",
"end_date": "9-15-2019",
"status":"wip",
"priority":"normal",
},
{
"description": "",
"assigned_to":"Keyon.Hill",
"start_date": "9-7-2019",
"end_date": "9-13-2019",
"status":"OnHold",
"priority":"low",
},
{
"description": "",
"assigned_to":"Bennett.Sanchez",
"start_date": "9-10-2019",
"end_date": "9-20-2019",
"status":"complete",
"priority":"low",
}
],
"distribution": [
{
"description": "",
"assigned_to":"Kemen.Adams",
"start_date": "9-12-2019",
"end_date": "9-20-2019",
"status":"complete",
"priority":"high",
}
]
}
从我看到的是这样的:
{
"type": "object",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "JSON schema generated with JSONBuddy https://www.json-buddy.com",
"properties": {
"taks": {
"$ref": "#/definitions/taks"
}
},
"definitions": {
"an_item": {
"type": "object",
"additionalProperties": false,
"properties": {
"assigned_to": {
"type": "string"
},
"description": {
"type": "string"
},
"end_date": {
"type": "string"
},
"priority": {
"type": "string"
},
"start_date": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"taks": {
"type": "object",
"properties": {
"development": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
},
"distribution": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
},
"production": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
},
"review": {
"type": "array",
"items": {
"$ref": "#/definitions/an_item"
}
}
}
}
}
}