Configuring global request parameters
See original GitHub issueCould we have a way for declaring global request parameters?
I’m working on an aggregation API that has its own authentication method. What I do is just to forward an Authentication
header to these APIs that will handle the authentication.
Currently, I have to set:
parameters:
- name: authorization
in: header
description: The user access token
required: true
in every request.
Is there an easy way to include a option that allows us to configure global request parameters? I’m pretty sure I’m not the only one with this need. Some coleagues of mine have worked with swagger some time ago and they told me they had faced the same issue.
Suggestions I have for this:
-
Having an wildcard entry on paths:
*: post: parameters: - name: authorization in: header description: The user access token required: true get: parameters: - name: authorization in: header description: The user access token required: true
It could be very repetitive if we needed to set the parameters for every request method.
-
Having an wildcard entry on paths that allows global path and global method configuration:
*: *: parameters: - name: authorization in: header description: The user access token required: true post: parameters: - name: another_one in: body description: Something required: true
This way, we could set global parameters for every method and refining if needed.
There should also be a way to ignore these global configurations, such as:
/signin:
post:
parameters:
- name: username
# ...
use_global_parameters: false
Also, there should be possible to overwrite the global configurations, like:
*:
*:
parameters:
- name: something
in: query
description: something
required: true
post:
parameters:
- name: something
in: body
description: Something
required: true
Issue Analytics
- State:
- Created 9 years ago
- Comments:15 (6 by maintainers)
I’ve got a few headers that are always sent back, and every request path has got multiple possible status codes, especially because >= 400 ranges are documented too.
I’ve got a few hundred of these repeating:
Can this issue be re-opened?
Is it possible to set a default apikey value like the one below.
I tried this, but it doesn’t work.