Thanks Ron,
This works for me. But now I am running into another issues,
When I am sending a GET request with following prototype, It sends a
OPTIONS call from swagger editor, which returns a 200 response, But how
will I send the GET request to get the API working.?
public Saying secret(@ApiParam(hidden = true) @Auth PrincipalImpl user) {
Thanks
Piyush
On Monday, October 9, 2017 at 11:01:47 PM UTC+5:30, Ron wrote:
>
> You can hide any generated parameter by adding the @ApiParam(hidden=true)
> annotation.
>
>
>
>
>
>
>
> *From: *<[email protected] <javascript:>> on behalf of
> Piyush Mendhiratta <[email protected] <javascript:>>
> *Reply-To: *"[email protected] <javascript:>" <
> [email protected] <javascript:>>
> *Date: *Monday, October 9, 2017 at 01:18
> *To: *Swagger <[email protected] <javascript:>>
> *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] <javascript:>.
> 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.