1

我有以下模式和 json,json 模式验证在 log 属性上失败,因为它在实例上找不到值“yes”。验证器工具https://www.jsonschemavalidator.net/中传递了相同的内容,但我的代码中没有。我不知道发生了什么事

[u'yes'] 不是 ['no', 'yes'] 之一

无法验证架构中的“枚举”['properties']['systems']['items']['properties']['log']: {'enum': ['no', 'yes']}

在实例['systems'][0]['log']:[u'yes']

架构

{
     "signatures": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },                  
                  "log": {
                    "enum": ["no", "yes"]
                  }                  
                },
                "additionalProperties": false
            } 
          }
}

JSON

{
    "signatures": [
        {                       
            "description": "Protocol",             
            "name": "attempt_1",            
            "log": [
                "yes"
            ],             
            "id": "1550",             
        }
      ]
 }
4

0 回答 0