You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When using springdoc-openapi I have found that sometimes it is necessary to define common headers for all endpoints. I am unaware of a simple way to configure these global headers in my OpenApi document.
Describe the solution you'd like
Ideally I would like a property driven approach where users can provide configuration of global headers which are automatically converted into OpenApi parameters and then referenced on all endpoints.
Describe alternatives you've considered
A solution to this exact problem is provided here, but this still requires users to manually apply a reference to the component on their API document, which could result in a lot of code duplication.
This can currently be solved by overriding the OpenApi bean or using an OpenApi customizer and creating global parameters which are automatically added to the OpenApi documents components section and then modifying all paths in the document to reference the global parameter $ref.
Additional context
I have experimented with implementing this using the following properties style and the method outlined above:
springdoc:
common-headers:
# Array of regex patterns used to exclude common # headers from certain endpoints, they match on # the paths documented by OpenApi.excluded-paths: []headers:
- name: common-headerexample: header-valuerequired: true# Regex patterns to use for exclusions of this# particular common header, these are combined # with those provided at the top level.excluded-paths: []
My main question comes down to would this be a feature springdoc would be willing to accept, if so I am happy to raise a PR for an implementation / discuss the concept further \(≧▽≦)/
We are open to contributions, but this feature is not right now part of our priority list as there are other workarounds.
Feel free to propose a PR, if you feel it useful for the community.
We are open to contributions, but this feature is not right now part of our priority list as there are other workarounds.
Feel free to propose a PR, if you feel it useful for the community.
Perfect, thank you, I will open a PR as proposed to add this feature!
Is your feature request related to a problem? Please describe.
When using springdoc-openapi I have found that sometimes it is necessary to define common headers for all endpoints. I am unaware of a simple way to configure these global headers in my OpenApi document.
Describe the solution you'd like
Ideally I would like a property driven approach where users can provide configuration of global headers which are automatically converted into OpenApi parameters and then referenced on all endpoints.
Describe alternatives you've considered
A solution to this exact problem is provided here, but this still requires users to manually apply a reference to the component on their API document, which could result in a lot of code duplication.
This can currently be solved by overriding the OpenApi bean or using an OpenApi customizer and creating global parameters which are automatically added to the OpenApi documents components section and then modifying all paths in the document to reference the global parameter $ref.
Additional context
I have experimented with implementing this using the following properties style and the method outlined above:
My main question comes down to would this be a feature springdoc would be willing to accept, if so I am happy to raise a PR for an implementation / discuss the concept further \(≧▽≦)/
cc: @Jack272Hughes @michaelmcfadyensky
The text was updated successfully, but these errors were encountered: