In Swagger, an @ApiImplicitParam
annotation is used to describe an implicit parameter that is applied to all endpoints of an API. This annotation can be used to specify details such as the name of the parameter, the data type of the parameter, and whether the parameter is required.
Here's an example of how to use the @ApiImplicitParam
annotation to specify an implicit parameter that is applied to all endpoints of an API:
@ApiImplicitParam(name = "Authorization", value = "Bearer token", required = true, dataType = "string", paramType = "header")
In this example, the @ApiImplicitParam
annotation is used to specify a header parameter named "Authorization" that is required for all endpoints of the API. The value of the parameter is a string in the format "Bearer token".
To apply this implicit parameter to all endpoints of the API, you can include the @ApiImplicitParam
annotation on the class level, as shown below:
@ApiImplicitParam(name = "Authorization", value = "Bearer token", required = true, dataType = "string", paramType = "header") @RestController public class MyController { ... }
This will apply the implicit parameter to all endpoints defined in the MyController
class.
You can find more information about the @ApiImplicitParam
annotation and other Swagger annotations in the Swagger documentation.