-
-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behavior when omitting content:
in Open API RequestBody
#6278
Comments
I've got the same issue, when I use Which seems in contradiction with ApiPlatform guide:
In the OpenApiFactory, with see that the If the As rewriting the whole schema's content is complex, it would nice to have the default value system within the I didn't check it, but I think a solution would be to decorate the OpenAPI Factory as menitoned in the documentation: Overriding the OpenAPI Specification. |
This is a major headache for my team as well, unfortunately. We're using API platform to create an RPC style API. Having all these automatically generated descriptions for responses and request parameters that refer to resources, makes no sense to us at all. Overriding the response description using Sure, we could decorate the There needs to be a simple way to override defaults generated by API platform, without loosing other stuff like automatically generated response bodies, for API platform to be usable for RPC style APIs. I'd be very interested in working on a PR to provide a fix, but at this time I don't really know where to start since I'm not very familiar with API platform internals. If anyone has any pointers, please let me know. If we can't find a solution to this within about 2 months, it's very likely we'll have to drop API platform altogether. Shipping API documentation with lots of incorrect and confusing texts to our customers is not an option. |
I gave up the overriding of the factory. I opened a discussion here: api-platform/api-platform#2680 I hope to see it in the next discussion round of @soyuka 🤞 |
Can't someone patch the openapi factory to set our defaults on non-existing parts of the RequestBody. |
@soyuka sure, I'll be glad to make a PR for that. But I was not sure if this behavior was expected or not from APIP. |
I defined an operation using
ApiResource
as follows because I wanted to customize the description for the request.When
content:
is omitted like this, the request body appears blank in the Swagger UI. To avoid this, I had to prepare an ArrayObject incontent:
as shown below.As you can see, the
InputPOPO
class only has an$email
property. Despite wanting to only rewrite the description, I have to specify verbose and extensive details.Wouldn't it be better if, when
openapi:
is omitted, the class specified ininput:
is referenced just like"$ref": "#/components/schemas/..."
? What do you think?The text was updated successfully, but these errors were encountered: