swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

1.5.x: ApiImplicitParams annotation is ignored

Open unoexperto opened this issue 11 years ago • 52 comments

When I first noticed this bug I thought it happens only when I use ApiParam and ApiImplicitParams at the same time.

Looks like ApiImplicitParams is ignored in any case. As result I can't document security token which intercepted by servlet filter earlier.

Here is endpoint

@GET
@Consumes("text/plain")
@Produces(MediaType.APPLICATION_JSON)
@Path("testParams")
@ApiOperation(response = String.class, value = "Returns string with provided parameter")
@ApiImplicitParams({@ApiImplicitParam(name = "token", required = true, dataType = "string", paramType = "query", value = "API token")})
public String testParams(@ApiParam(required = false, value = "ID of timesheet") @QueryParam("id") int id) {}

Example project is located at https://github.com/cppexpert/broken_swagger_jaxrs_integration

unoexperto avatar Mar 10 '15 17:03 unoexperto

Will check that, but spec-wise, you're probably better off describing it as a security definition and not as an operation parameter.

webron avatar Mar 10 '15 17:03 webron

According to earlier conversation here (in another issue) security definition is not going to work for me for multiple reasons one of which is lack of support of unauthenticated endpoints.

unoexperto avatar Mar 10 '15 17:03 unoexperto

Can you refer me to that discussion please?

webron avatar Mar 10 '15 17:03 webron

https://github.com/swagger-api/swagger-core/issues/889

And even "api_key" wasn't working in my sample app anyway. Filling out that field in swagger-ui never passed it with the request.

unoexperto avatar Mar 10 '15 17:03 unoexperto

Hi Ron! Could you please tell me what rough ETA for the fix is ? Thanks!

unoexperto avatar Mar 14 '15 15:03 unoexperto

A release should be around next weekend. The fix may be available earlier via a snapshot.

webron avatar Mar 14 '15 15:03 webron

How is it going with new release, guys ? This bug is quite critical too https://github.com/swagger-api/swagger-core/issues/847

unoexperto avatar Mar 23 '15 19:03 unoexperto

Hi @cppexpert M2 is off by a week. I can certainly do a point release of M1.

Watch for 1.5.3-M1 in a bit.

fehguy avatar Mar 23 '15 19:03 fehguy

1.5.3-M1 is now released. It should appear in maven central shortly

fehguy avatar Mar 23 '15 20:03 fehguy

But neither #847 nor #905 are fixed in 1.5.3-M1, right ?

unoexperto avatar Mar 23 '15 20:03 unoexperto

Implicit params are supported (was the original issue posted here). Did you look at the fix in the sample project you provided?

The model issue #847 is not quite done yet.

fehguy avatar Mar 23 '15 20:03 fehguy

I tried using 1.5.3-M1 with my work project. Implicit parameters are still not visible.

unoexperto avatar Apr 06 '15 15:04 unoexperto

I am having the same problem with the ApiImplicitParam annotation. I spent some time looking over the latest code (1.5.0-M2) and couldn't see any references to this annotation in any of the source code. I did see a reference in the old 1.3.12 code (in the JaxrsApiReader.scala class). I think the equivalent class for 1.5 would be the Reader class, but couldn't find an equivalent code block.

sanchopancho13 avatar Apr 07 '15 01:04 sanchopancho13

This implicit parameter code path should be well tested. If you can please provide an example of what is not working we can figure it out.

fehguy avatar Apr 07 '15 01:04 fehguy

Hi @fehguy. The simplest test I could devise was the following:

  1. Downloaded the latest swagger-core code from master (which is currently 1.5.1-M2).
  2. In the samples/java-jaxrs project, edited the PetResource class by adding the following annotation to the getPetById method:
  @ApiImplicitParams({
      @ApiImplicitParam(name = "sort", paramType = "query", dataType = "string", required = false, value = "Comma-delimited list of fields to sort by.")
  })
  1. [I also changed the description of the operation to make sure that I was seeing my latest changes.]
  2. Ran the sample project with the maven jetty command.
  3. Viewed the new documentation in a local swagger-ui instance. The implicit parameter is not displayed.

sanchopancho13 avatar Apr 07 '15 04:04 sanchopancho13

Any update on this issue? It seems that there is no reference of @ApiImplicitParams in source code even though the documentation is complete.

buremba avatar Apr 24 '15 20:04 buremba

Yes, it's a defect. Working on it.

fehguy avatar Apr 24 '15 20:04 fehguy

Any update on this? Can I help at all ?

who avatar May 14 '15 06:05 who

It will be handled soon.

webron avatar May 14 '15 08:05 webron

sorry, maybe a bit off the topic, I also ran into an issue with @ApiParam swagger-core 1.5.1-M2. I wrote a customized SwaggerSpecFilter to filter out some internal param. Whenever I tried to access the "access" property of Parameter in method isParamAllowed, it's alway null. Is this feature missing in 1.5.1-M2?

Thanks,

thegreatdao avatar May 19 '15 16:05 thegreatdao