Upon sending a request with an invalid JSON request body, the response returns a allOf constraint violation in the list of violations when allOf is used in the request body JSON schema of the operation. This constraint violation is unclear in the context of the response as the actual constraint violation is above it.
Assume the following request body JSON schema:
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/SomeObject'
- type: object
properties:
someProperty:
type: string
required:
- someProperty
When sending a request to the operation without someProperty property inside the request body, the following error response is returned:
{
"type": "about:blank",
"title": "The request body contains errors.",
"status": 400,
"detail": "Validation of JSON request body failed.",
"violations": [
{
"constraint": "required",
"message": "The property someProperty is required",
"property": "someProperty"
},
{
"constraint": "allOf",
"message": "Failed to match all schemas",
"property": ""
}
]
}
Here the allOf constraint violation is unclear and redundant for the API consumer. I'd expect the response to be the following:
{
"type": "about:blank",
"title": "The request body contains errors.",
"status": 400,
"detail": "Validation of JSON request body failed.",
"violations": [
{
"constraint": "required",
"message": "The property someProperty is required",
"property": "someProperty"
}
]
}
Upon sending a request with an invalid JSON request body, the response returns a
allOfconstraint violation in the list of violations whenallOfis used in the request body JSON schema of the operation. This constraint violation is unclear in the context of the response as the actual constraint violation is above it.Assume the following request body JSON schema:
When sending a request to the operation without
somePropertyproperty inside the request body, the following error response is returned:{ "type": "about:blank", "title": "The request body contains errors.", "status": 400, "detail": "Validation of JSON request body failed.", "violations": [ { "constraint": "required", "message": "The property someProperty is required", "property": "someProperty" }, { "constraint": "allOf", "message": "Failed to match all schemas", "property": "" } ] }Here the
allOfconstraint violation is unclear and redundant for the API consumer. I'd expect the response to be the following:{ "type": "about:blank", "title": "The request body contains errors.", "status": 400, "detail": "Validation of JSON request body failed.", "violations": [ { "constraint": "required", "message": "The property someProperty is required", "property": "someProperty" } ] }