定义项的有效名称
Valid name for definitions item
定义(假设名称为 "abc")然后从类型为 "array" 的名为 "abc" 的属性引用它是否正确?或者它不正确,数组及其项必须具有不同的名称?
谢谢!
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "newSchema.json",
"title": "newSchema",
"type": "object",
"definitions": {
"abc": {
"properties": {
"some_col": {
"description": "hi",
"type": "integer"
}
}
}
},
"properties": {
"abc": {
"type": "array",
"items": {
"$ref": "#/definitions/abc"
}
}
}
}
这是一个完全有效的 JSON 结构和 JSON 架构设置。
如果您打算让其他人阅读您生成的模式,您可以向它们添加注释以提供额外信息,例如“这是一个 [table] 的数组”和“此对象代表一行在 [table]".
查看Schema Annotations section of the JSON Schema draft-7 validation specification。
定义(假设名称为 "abc")然后从类型为 "array" 的名为 "abc" 的属性引用它是否正确?或者它不正确,数组及其项必须具有不同的名称?
谢谢!
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "newSchema.json",
"title": "newSchema",
"type": "object",
"definitions": {
"abc": {
"properties": {
"some_col": {
"description": "hi",
"type": "integer"
}
}
}
},
"properties": {
"abc": {
"type": "array",
"items": {
"$ref": "#/definitions/abc"
}
}
}
}
这是一个完全有效的 JSON 结构和 JSON 架构设置。
如果您打算让其他人阅读您生成的模式,您可以向它们添加注释以提供额外信息,例如“这是一个 [table] 的数组”和“此对象代表一行在 [table]".
查看Schema Annotations section of the JSON Schema draft-7 validation specification。