Just add "@ApiParam(hidden=true)" to your @Auth parameter to get Swagger to 
understand it's not a request entity class.


On Monday, October 9, 2017 at 4:19:20 AM UTC-4, Piyush Mendhiratta wrote:
>
> I am trying to create swagger using the swaggerUI. My API framework uses 
> dropwizard. Now when I am trying to use a GET resource with @Auth for 
> authentication, swagger that is generated have a body that should have a 
> "User". But ideally any GET request should not have a "body". ANy 
> suggestions on how to deal with the situation. Or if anyone has used 
> swagger with dropwizard.
>
> @GET
> @Path("/all/{userName}/")
> @Produces(MediaType.APPLICATION_JSON)
> @ApiOperation(
>         value = "Journal Number",
>         notes = "Returns Journal Number for a company",
>         response = GeneralLedger.class,
>         authorizations = {@Authorization(value="basicAuth")})
> public Response classInfoForUsername
>         (@Auth AuthenticatedUser user,
>          @PathParam("userName") String userName) {
>
> ....
>
> }
>
>
>
>
>
> Swagger generated is :
>
>
>  "/class/all/{userName}" : {
>       "get" : {
>         "summary" : "Journal Number",
>         "description" : "Returns Journal Number for a company",
>         "operationId" : "classInfoForUsername",
>         "consumes" : [ "application/json" ],
>         "produces" : [ "application/json" ],
>         "parameters" : [ {
>           "in" : "body",
>           "name" : "body",
>           "required" : false,
>           "schema" : {
>             "$ref" : "#/definitions/AuthenticatedUser"
>           }
>         }, {
>           "name" : "userName",
>           "in" : "path",
>           "required" : true,
>           "type" : "string"
>         } ],
>         "responses" : {
>           "default" : {
>             "description" : "successful operation"
>           }
>         },
>         "security" : [ {
>           "basicAuth" : [ ]
>         } ]
>       }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to