Provide more detail for validation errors from `allOf` etc
Issue #25
resolved
The JSON Schema Validation lib includes a reports
field that has extra information for top-level validation errors such as allOf
.
It would be useful to include this information in error messages emitted by the Swagger validator.
An example schema that can generate the report:
{
"$ref": "#/definitions/Cat",
"definitions": {
"Pet": {
"type": "object",
"discriminator": "petType",
"properties": {
"name": {
"type": "string"
},
"petType": {
"type": "string"
}
},
"required": [
"name",
"petType"
]
},
"Cat": {
"description": "A representation of a cat",
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"type": "object",
"properties": {
"huntingSkill": {
"type": "string",
"description": "The measured skill for hunting",
"default": "lazy",
"enum": [
"clueless",
"lazy",
"adventurous",
"aggressive"
]
}
},
"required": [
"huntingSkill"
]
}
]
},
"Dog": {
"description": "A representation of a dog",
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"type": "object",
"properties": {
"packSize": {
"type": "integer",
"format": "int32",
"description": "the size of the pack the dog is from",
"default": 0,
"minimum": 0
}
},
"required": [
"packSize"
]
}
]
}
}
}
with body:
{
"name":"My Cat",
"petType":"Cat"
}
Comments (6)
-
Account Deactivated -
reporter Sorry - haven't had a chance to look at it yet :( I will try to soon.
-
Account Deactivated ok..thanks..
-
reporter - changed status to open
-
Account Deactivated Hi James...I tested this locally with the branch and noticed that we are now getting error details from schema validator...I think it looks good..thanks for fixing it..
-
reporter - changed status to resolved
Available in 1.0.7
- Log in to comment
Hi James...any update on this ticket?