0
を失敗している私が闊歩検証が奇妙である何はなぜ闊歩バリデータは、ここで
を失敗している理由を把握することができないよう、私は複数のパスを追加した場合、検証は最後のものだけ文句を言うことです。それから最後のものを取り除くと、その上のものについて不平を言ってくる。
スガッガーエディターで作業するときは、すべてが検証されているようです。次のように
闊歩文書がある:
{
"swagger":"2.0",
"info":{
"version":"0.0.1",
"title":"Bla API"
},
"schemes":[
"https"
],
"produces":[
"application/json"
],
"host":"rest.bla.com",
"basePath":"/api/v2/fleet",
"paths":{
"/{organisation_id}/access_groups":{
"get":{
"tags":[
"Access Group"
],
"summary":"Get access groups\n",
"description":"Gets a list of 'access_group' objects based on the provided search criteria\n",
"parameters":[
{
"in":"path",
"name":"organisation_id",
"required":"true",
"type":"string"
},
{
"name":"term",
"in":"query",
"required":"false",
"type":"string"
},
{
"name":"take",
"in":"query",
"required":"true",
"type":"integer",
"format":"int32"
},
{
"name":"skip",
"in":"query",
"type":"integer",
"format":"int32",
"required":"true"
},
{
"name":"order",
"in":"query",
"type":"string"
}
],
"responses":{
"403":{
"description":"Permission Denied",
"schema":{
"$ref":"#/definitions/error"
}
},
"200":{
"description":"OK",
"schema":{
"type":"object",
"properties":{
"data":{
"type":"array",
"items":{
"$ref":"#/definitions/access-group-response"
}
},
"pagination":{
"$ref":"#/definitions/pagination"
}
}
}
}
}
}
}
},
"definitions":{
"access-group":{
"description":"an object which provides the ability to grant access to specific assets\n",
"properties":{
"name":{
"type":"string"
}
}
},
"access-group-response":{
"properties":{
"data":{
"$ref":"#/definitions/access-group"
},
"links":{
"type":"array",
"items":{
"$ref":"#/definitions/link"
}
}
}
},
"error":{
"type":"array",
"items":{
"type":"object",
"properties":{
"type":{
"type":"string"
},
"code":{
"type":"string"
},
"message":{
"type":"string"
},
"key":{
"type":"string"
}
}
}
},
"link":{
"properties":{
"href":{
"type":"string"
},
"rel":{
"type":"string"
}
}
},
"pagination":{
"properties":{
"page":{
"type":"number",
"format":"int32"
},
"total":{
"type":"number",
"format":"int32"
}
}
}
}
}
次のように検証エラーがあるとき:
{
"schemaValidationMessages":[
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/0"
}
},
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/1"
}
},
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/2"
}
},
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/3"
}
}
]
}