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

Ignore JAX-RS method parameters with specific annotations

Open matthias-mueller opened this issue 3 years ago • 2 comments

It there a preferred method to ignore / skip parameters by annotation?

Swagger-jaxrs at least ignores some annotated parameters by default (e.g. @Context) so that auto-injected elements like UriInfo do not appear in the generated OpenAPI description.

Can I pass additional annotations (e.g. my.custom.Auth) to the SwaggerConfiguration so that parameters with these annotations are also excluded from the rendered OpenAPI description?

Example:

    @GET
    public Stuff getStuff(
            @PathParam("code1") String code1, // include in OpenAPI spec
            @PathParam("code2") String code2, // include in OpenAPI spec
            @Context UriInfo requestUri, // excluded from OpenAPI spec, works as expected
            @Auth AuthUser authUser // @Auth param included by swagger, but I want to exclude this *globally* for all scanned resources
    ) {
       // fancy stuff inside
    }

matthias-mueller avatar Sep 01 '22 13:09 matthias-mueller

I have the same question. Did you find any workarounds? @matthias-mueller

deepakgummi avatar Sep 12 '22 19:09 deepakgummi