-
-
Notifications
You must be signed in to change notification settings - Fork 841
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
[feature] @OA\RequestBody, but for "query" #1721
Comments
This is actually supported using openapi 3 features, please see #1596 (comment). In summary, you should use an usual |
Closing as fixed, feel free to reopen if this is not the case. |
Does anybody have a working implementation for this? Currently doing
and getting Side question: Does the bundle pick up parameters that are in traits? Edit: Anwser, yes! But those seem to be cached, so you have to clear caches to make them visible in the doc. |
y'all probably want |
can you try Basically remove the schema bit and put the |
new OAT\Parameter(name: 'query', in: 'query', ref: new Model(type: AccountFilterDTO::class), style: 'form', explode: true) when used through alias |
@PetrNovotnyGS or someone else, do you have a solution maybe? |
Same issue. Have you a solution? |
@GuilhemN @chrisguitarguy |
So I've spent some time going down the rabbithole of this issue: By all accounts, the feature requested here is not possible at the moment. This is also not a bug, but rather a limitation of the OpenApi specification. That means the issue is waaaay upstream. This has also been discussed in the swagger-php repository, e.g. in zircote/swagger-php#663 with limited solutions. One possible solution would be to augment the doc-generation with a custom parameter, that transforms the parameters of the referenced model the way we want. An example can be found here: https://github.com/zircote/swagger-php/pull/783/files The downside of this solution is the fact, that So my proposed solution would be to allow exactly that: Custom processors through the yml config. I'll open a feature request for that. |
Resolving this is now possible with #2149 and has been released in
Note: You can influence WHEN the processor is run by giving the tag a |
Version
I am using version
4.0@dev
.Problem
I define all my request parameters in a "Model" class. By using the
@OA\RequestBody
annotation I get my parameters documented automatically. This works great for all POST/PATCH/PUT requests that have a body. For GET requests I also like to define my parameters in a Model class.As a "workaround" to document the endpoints I put "query" in the description. However, I can then not use the "Try it out" feature. Here is my implementation:
Feature
What I'd like to see is an
@OA\RequestBody
annotation for query parameters (@OA\RequestQuery
?) so that I can define my query parameters in my Model class.My Model classes contains the types and validations, one place where everything is defined. I don't want to define
OA\Parameter
annotations on my route too.The text was updated successfully, but these errors were encountered: