question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configuring global request parameters

See original GitHub issue

Could 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:

  1. 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.

  2. 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:closed
  • Created 9 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
StephanBijzittercommented, Jul 25, 2021

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:

local checkbuster ninja_8444_api-docs_

Can this issue be re-opened?

0reactions
deepan-itelacommented, Jul 31, 2018

Is it possible to set a default apikey value like the one below.

securityDefinitions:
  forwarded:
    name: authorization
    type: apiKey
    in: header
    default: myapikey

I tried this, but it doesn’t work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global Configuration parameter list - BMC Documentation
Global configuration parameters provide basic information that is automatically supplied as the default during catalog creation and update ...
Read more >
View Global Parameter Values (REST API: POST)
This operation returns the values for global parameters. Request. Syntax. POST <webservice>/CommServ/GlobalParams HTTP/1.1
Read more >
spring - Global Parameter set using Open API configurations?
In this example, I am looking to globally set the headers ( Custom-Header-Version=v1 ) which I want to pass while making a request...
Read more >
Global Parameters | REST API Handbook
The API includes a number of global parameters (also called “meta-parameters”) which control how the API handles the request/response handling.
Read more >
Add Global parameters in SpringFox Swagger with Spring Boot
There are cases where we need some header value from clients to validate the request. Example — In our project, we had to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found