-
-
Notifications
You must be signed in to change notification settings - Fork 957
Closed
Description
API Platform version(s) affected: 4.2
Description
When writing the following route
new Post(
uriTemplate: '/foo',
status: 202,
security: "is_granted('foo', object)",
input: FooInput::class
output: false,
processor: FooProcessor::class,
),
I expect
- That my route could send 422 in case of validation error of FooInput, with the list of the validation error.
- That my route could send 400 in case of invalid input
- That my route could send 403 in case of missing rights
- That my route could return a 202 without content in case of success.
I DO get this behavior, ie
- A 202 returns an empty content
- A 422 returns the list of violations
BUT the schema generated is
"202": {
"description": "Foo",
"links": {}
},
"400": {
"description": "Invalid input",
"links": {}
},
"422": {
"description": "An error occurred",
"links": {}
},
"403": {
"description": "Forbidden",
"links": {}
}
instead of classics
"422": {
"description": "An error occurred",
"content": {
"application/ld+json": {
"schema": {
"$ref": "#/components/schemas/ConstraintViolation.jsonld"
}
},
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ConstraintViolation"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConstraintViolation"
}
}
},
"links": {}
},
I think it's related to your change in #7384 @soyuka
If I remove the !$noOutput in
core/src/OpenApi/Factory/OpenApiFactory.php
Line 511 in c8493bb
| if (null === $response->getContent() && $responseMimeTypes && $operationOutputSchemas && !$noOutput) { |
I get back my content and schema.
But I also get
"202": {
"description": "User resource created",
"content": {
"application/json": {
"schema": {}
},
"application/ld+json": {
"schema": {}
}
},
"links": {}
},
which was maybe what you wanted to avoid.
Metadata
Metadata
Assignees
Labels
No labels