question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support @ApiImplicitParams at the class level

See original GitHub issue

Feature request: Support the @ApiImplicitParams annotation at the class level. It was recently updated in swagger-core to be applicable to the class level.

We use this feature to add a parameter to every controller mapping asking for a special auth header: @ApiImplicitParams({@ApiImplicitParam(name = "Authorization", value = "Authorization token", required = true, dataType = "string", paramType = "header", defaultValue = "Bearer X")})

It would be handy to annotate the controller and get this automatically on every endpoint.

For now we have created a custom annotation to at least make our controller code look cleaner:

@Inherited
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@ApiImplicitParams({@ApiImplicitParam(name = "Authorization", value = "Authorization token", required = true, dataType = "string", paramType = "header", defaultValue = "Bearer X")})
public @interface AddSwaggerToken {
}

We then simply annotate all controller methods with @AddSwaggerToken

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dilipkrishcommented, Jul 11, 2018

💯 agree. I think there is should be another issue for that…

1reaction
dilipkrishcommented, Feb 7, 2017

You can already do this at the docket see Docket#globalOperationParameters

Read more comments on GitHub >

github_iconTop Results From Across the Web

ApiImplicitParam (swagger-annotations 1.5.12 API)
Represents a single parameter in an API Operation. While ApiParam is bound to a JAX-RS parameter, method or field, this allows you to...
Read more >
Using Multiple Custom Annotations for the same property ...
I have two custom annotations which need to be created to be added on controller endpoints both have the same property @ApiImplicitParams ......
Read more >
Web Services OpenAPI - Confluence Mobile - Internet2 Wiki
GROUPER_OPENAPI_TITLE, My institution's group service web ... Edit the request and response beans at the class level (make sure to be ...
Read more >
Java Examples for com.wordnik.swagger.annotations ...
This java examples will help you to understand the usage of ... works well at street level", response = FeatureCollection.class) @ApiImplicitParams({ ...
Read more >
Swagger Annotations for Rest API Documentation - Java Guides
Marks a class as a Swagger resource. @ApiImplicitParam, Represents a single parameter in an API Operation. @ApiImplicitParams, A wrapper to allow a list...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found