We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I have a requirement to add a common header to every API call so I've come up with the following:
public interface OpenAPICustomiser { public void customise(OpenAPI openApi); }
@RestController public class CustomisableOpenApiResource extends org.springdoc.api.OpenApiResource { private final Optional<List<OpenAPICustomiser>> openApiCustomisers; . . . @Override protected OpenAPI getOpenApi() { final OpenAPI openApi = super.getOpenApi(); if (openApiCustomisers.isPresent()) { openApiCustomisers.get().stream().forEach(openApiCustomiser -> openApiCustomiser.customise(openApi)); } return openApi; }
@Bean public OpenAPICustomiser consumerTypeHeaderOpenAPICustomiser() { return openApi -> openApi.getPaths().values().stream().flatMap(pathItem -> pathItem.readOperations().stream()) .forEach(operation -> operation.addParametersItem(new HeaderParameter().$ref("#/components/parameters/myConsumerTypeHeader"))); }
Would it be possible to provide this ability in the default org.springdoc.api.OpenApiResource?
Thanks
The text was updated successfully, but these errors were encountered:
Can you propose a pull request, with this feature ?
Sorry, something went wrong.
sure will have a go this week. Thanks
https://github.com/springdoc/springdoc-openapi/issues/92
a9aa2d5
@springdoc have a look at
#93
Merge pull request #93 from davidmelia/OpenAPICustomiser
490b987
#92
Thank you for your contribution. This feature, will be available on v1.1.43 of springdoc-openapi.
davidmelia
No branches or pull requests
Hi,
I have a requirement to add a common header to every API call so I've come up with the following:
springdoc.api-docs.enabled=false
Would it be possible to provide this ability in the default org.springdoc.api.OpenApiResource?
Thanks
The text was updated successfully, but these errors were encountered: