Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Springfox #845: Configuration for global Operation-Parameters. #861

Merged
merged 1 commit into from Aug 11, 2015
Merged

Springfox #845: Configuration for global Operation-Parameters. #861

merged 1 commit into from Aug 11, 2015

Conversation

GitVhaos
Copy link
Contributor

Added support for configuration of global operation parameters.

Added support for configuration of global operation parameters.
@dilipkrish
Copy link
Member

@GitVhaos sorry I had forgotten about this! i'll take a look and merge it in if everything looks ok! Thanks very much for your pr! 👍

@dilipkrish dilipkrish merged commit 6990c9a into springfox:master Aug 11, 2015
@dilipkrish
Copy link
Member

@GitVhaos would be awesome if you could also update the docs 👍

@GitVhaos
Copy link
Contributor Author

GitVhaos commented Sep 8, 2015

I`m new to gitHub... Where can I update the docs? ^^

@dilipkrish
Copy link
Member

Depends on what you're trying to document... but here is the directory where the documentation lives.

GitVhaos added a commit to GitVhaos/springfox that referenced this pull request Oct 12, 2015
GitVhaos added a commit to GitVhaos/springfox that referenced this pull request Oct 12, 2015
@thadc23
Copy link

thadc23 commented May 25, 2016

Is there a way to hide/show these global parameters by HttpMethod? For example, I have a header param that I only want on every POST, PUT, and PATCH operation, but not on the others. Before I give it a shot with a PR, I wanted to make sure it wasn't already possible and I was just missing it.

@dilipkrish
Copy link
Member

@thadc23 yes there is way, but at the moment you'd have to partition your apis into multiple dockets. So it will apply global parameters per docket. I believe there is a feature request to allow global parameters using a selector predicate. But it may be marked as a "Someday Maybe" feature. (I'll update this thread once I find it)

Let me know if you need any help working through it.

@thadc23
Copy link

thadc23 commented Jun 5, 2016

@dilipkrish Were you ever able to find the feature for global params using a selector predicate? For a relatively small change and to implement filtering by method, I could add a List of HttpMethods to the Parameter and change the OperationParameterReader to filter the global list by the current operation's http method before adding the globals to the parameters for that operation.

To ensure backwards compatibility, I would add a second constructor to the Parameter that accepts a list of HttpMethods and have the current constructor call the new one with the List of all HttpMethods.

Thoughts?

@dilipkrish
Copy link
Member

I think there is a solution described here that is preferable.

@dilipkrish
Copy link
Member

Basically creating a plugin that adds parameters conditionally.

@thadc23
Copy link

thadc23 commented Jun 8, 2016

Got it working using the plugin. Thanks.

@dilipkrish
Copy link
Member

👍

@avineshsachan
Copy link

avineshsachan commented Jun 21, 2016

__

Can we set GlobalOperationParameters in Docket Bean at run time as a authentication Token:

docket.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build().globalOperationParameters(Lists.newArrayList(new ParameterBuilder()
.name("sso-token")
.description("Description of someGlobalParameter")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(true).defaultValue**("Run Tme Value get from SSO Service")**
.build()));

Please share a way to to it

Thanks in advance.

1 similar comment
@avineshsachan
Copy link

avineshsachan commented Jun 21, 2016

__

Can we set GlobalOperationParameters in Docket Bean at run time as a authentication Token:

docket.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build().globalOperationParameters(Lists.newArrayList(new ParameterBuilder()
.name("sso-token")
.description("Description of someGlobalParameter")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(true).defaultValue**("Run Tme Value get from SSO Service")**
.build()));

Please share a way to to it

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants