"some list": [
{
"thing 1": "foo",
"thing 2": 100
},
{
"thing 1": "foo",
"thing 2": 100
},
{
"thing 1": "foo",
"thing 2": 100
},
]
我有一个工作模式,它具有我想摆脱的额外关键名称,标记为I WANT TO GET RID OF THIS NAME
。我想您可以认为它没有该对象的属性名称。
{
"$schema": "http://json-schema.org/draft-07/schema#",
"id": "v2",
"properties": {
"some list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"I WANT TO GET RID OF THIS NAME": {
"type": "object",
"properties": {
"thing 1": {
"type": "string",
"description": "a string"
},
"thing 2": {
"type": "integer",
"minimum": 0,
"description": "Default time to expose a single image layer for."
}
},
"additionalProperties": false
},
"additionalProperties": false
}
}
}
}
}
我不能仅仅因为架构规格所期望的是git放弃名称,但是我也不知道如何告诉它这些对象没有名称。我使用python 3.7使用
jsonschema Draft7Validator
运行此示例您可以摆脱该属性是正确的 - 它是指错误的嵌套水平。模式应该看起来像:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"id": "v2",
"properties": {
"some list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"thing 1": {
"type": "string",
"description": "a string"
},
"thing 2": {
"type": "integer",
"minimum": 0,
"description": "Default time to expose a single image layer for."
}
},
"additionalProperties": false
}
}
}
}