0

I am using springfox to generate swagger urls for rest end points. I have a specific rest endpoint that does not require a request parameter on the controller level, but requires request parameter on a filter that pre-handles the request.

I want to define a request parameter on the Docket in the Docket definition and not on the controller because annotating parameters on the controller makes it really dirty and hard to read.

In other words, i want to define swagger parameter without using ApiImplicitParams, and instead define it on the Docker.

Any advice? Thanks

Yuval Zilberstein
  • 175
  • 1
  • 4
  • 11

1 Answers1

0

This can be accomplished by using the globalOperationParameters method on the Docket builder.

    return new Docket(DocumentationType.SWAGGER_2)
    ...
    .globalOperationParameters(
        newArrayList(new ParameterBuilder()
            .name("someGlobalParameter")
            .description("Description of someGlobalParameter")
            .modelRef(new ModelRef("string"))
            .parameterType("query")
            .required(true)
            .build()))
mvd
  • 2,596
  • 2
  • 33
  • 47