You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
In our project we have need to pass Request object to our controller. This is the routes file POST /check controllers.CheckConotroller.checkStatus(request: Request)
Swagger is generating this output for the parameters object: "parameters": [ { "name": "request", "in": "query", "required": false, "type": "string" } ],
Is there any way to remove the request parameter from the swagger generation?
In swagger annotations document (https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X#apiparam), there is a reference to the @ApiParam annotation and hidden flag, but that does not work. With @ApiParam you can control what metadata you want to generate for the given query parameter, but as soon as you set hidden to true, all metadata are ignored and parameter is still in documentation.
An example
If you have controller method declaration like this: public CompletionStage<Result> checkStatus(@ApiParam(required = true, type = "1", value = "something") Http.Request request)
then you get this in documentation: "parameters": [ { "name": "request", "in": "query", "description": "something", "required": true, "type": "1" } ],
However, if you set hidden to true: public CompletionStage<Result> checkStatus(@ApiParam(required = true, type = "1", value = "something", hidden = true) Http.Request request)
then all annotation metadata is ignored and parameter is reverted back (or it is indeed removed, but default one is added once again): "parameters": [ { "name": "request", "in": "query", "required": false, "type": "string" } ],
Adding an implicit parameter with the same name,, just adds another parameter without affecting the existing one.
Using Play for Java version: 2.7.0
and swagger-play2 version: 1.6.1
The text was updated successfully, but these errors were encountered:
dsnkostic
changed the title
Hiding query parameter from the controller method
Hidding query parameter from the controller method
Jun 19, 2019
We've come across this issue moving to play 2.7, where the HTTP Request really needs to be added to the route as a parameter.
Our solution is to intercept the request and just remove any route parameters with the name of "request".
This is an easy solution assuming that the route being added is always the same name, and that there aren't any real API parameters also named "route".
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In our project we have need to pass Request object to our controller. This is the routes file
POST /check controllers.CheckConotroller.checkStatus(request: Request)
Swagger is generating this output for the parameters object:
"parameters": [ { "name": "request", "in": "query", "required": false, "type": "string" } ],
Is there any way to remove the request parameter from the swagger generation?
In swagger annotations document (https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X#apiparam), there is a reference to the
@ApiParam
annotation and hidden flag, but that does not work. With@ApiParam
you can control what metadata you want to generate for the given query parameter, but as soon as you set hidden to true, all metadata are ignored and parameter is still in documentation.An example
If you have controller method declaration like this:
public CompletionStage<Result> checkStatus(@ApiParam(required = true, type = "1", value = "something") Http.Request request)
then you get this in documentation:
"parameters": [ { "name": "request", "in": "query", "description": "something", "required": true, "type": "1" } ],
However, if you set hidden to true:
public CompletionStage<Result> checkStatus(@ApiParam(required = true, type = "1", value = "something", hidden = true) Http.Request request)
then all annotation metadata is ignored and parameter is reverted back (or it is indeed removed, but default one is added once again):
"parameters": [ { "name": "request", "in": "query", "required": false, "type": "string" } ],
Adding an implicit parameter with the same name,, just adds another parameter without affecting the existing one.
Using Play for Java version: 2.7.0
and swagger-play2 version: 1.6.1
The text was updated successfully, but these errors were encountered: