You can hide any generated parameter by adding the @ApiParam(hidden=true) 
annotation.

 

 

 

From: <[email protected]> on behalf of Piyush Mendhiratta 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Monday, October 9, 2017 at 01:18
To: Swagger <[email protected]>
Subject: Swagger Dropwizard Authentication

 

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 
"Swagger" 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.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" 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