-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
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:
- somePropertyWhen 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"
}
]
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
To do