Complete missing OpenAPI informations for other model object than operation #2680
Replies: 1 comment
-
I'm going to shamelessly copy & paste my response from another discussion here :)
|
Beta Was this translation helpful? Give feedback.
-
Hi, I tried to change the OpenAPI description of a request's body with this code:
Within the
openapi.json
, therequestBody
appears, without content. In the UI, the whole blank is blank. I think that's an issue related to SwaggerUI.But this lead me to find out that this guide page Extend OpenAPI Documentation saying :
It's true, but only for fields directly within
Model\Operation
constructor.By looking at the
OpenApiFactory
code, see L396-L408, if there's noRequestBody
withinopenapi:
it generates the whole default object.Then, if in
openapi:
we just want to edit the description with anew RequestBody(description: "Another description")
, and then we'll end up with a request body with nocontent:
.The issue, is that generating OpenAPI content it pretty complex depending on the size of the resource. Moreover there are several schemas to specify if we have several formats available, like json or jsonld. It breaks the powerful automation of API Platform around the documentation
I think that something could be done by decorating the factory, but I'm not at ease with the factory, and it seems there are many things to be done to gather informations to generate the schema, etc ...
💡 I'll be glad to discuss the possibility to bring the "add the missing information" from the docs, to sub part of the OpenAPI model object, and if I can help to do so.
Related discussion I found:
Beta Was this translation helpful? Give feedback.
All reactions