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.

Experiments with templated hosts

See original GitHub issue

On the TDC call today, we experimented with a few different options for enabling parameterized host, schema and basePath. Community feedback would be much appreciated.

Option 1: Global parameters are back


{
    "openapi" : "3.0.0",

    "parameters" : {
        "version" : {
            "in" : "basepath",
            "default" : "v1.0", 
            "schema" : {
                "type" : "string"
            }
        },

        "environment" : {
            "in" : "host",
            "required" : true, 
            "schema" : {
                "type" : "string"
            }
        }
    },

    "hosts" : [
        { 
          "host" : "{environment}.example.org",
          "basePath" : "/{version}/api",
           "scheme" : "https"
         }
    ]

}

This is a minimally intrusive option but it brings the parameters back at the global scope which we are not particularly keen to do.

The next option trades the current array of hosts into a server object so that it can contain the host related parameters. It also means that there is only one baseUrl, but it can be parameterized and in fact the entire thing could be a parameter, which could allow for multiple static values using an enum parameter.

{
    "openapi" : "3.0.0",

    "server" : {
       "baseUrl" : "{scheme}://{environment}.example.org/{version}/api",

        "parameters" : [
             {
                "name" : "scheme", 
                "in" : "host",
                "default" : "https", 
                "schema" : {
                    "type" : "string"
                }
            },
             {
                "name" : "version", 
                "in" : "host",
                "required" : false, 
                "default" : "v1.0", 
                "schema" : {
                    "type" : "string"
                }
            },

            {
                "name" : "environment",
                "in" : "host",
                "required" : true, 
                "schema" : {
                    "type" : "string"
                }
            }

        ]
    }

}

There are concerns about how default values work in these parameters and the "in" : "host" is redundant but there just for consistency with the parameter object definition.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
darrelmillercommented, Sep 6, 2016

Open 3.0 does have path item parameters, which is a bit less redundant than operation parameters, but still a little annoying. How do you feel about defining a parameters object inside a hosts/server object?

0reactions
fehguycommented, Feb 1, 2017

Since #812 was merged, I’m closing this out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Experiment ideas: Tactics and templates for consistent, high ...
Experiment ideas: Tactics and templates for consistent, high quality ideas · Run Ideation Sessions with Teams · Host an Experiment Idea “Hack-a-thon” ·...
Read more >
Overview of Basic Design of Experiments (DOE) Templates
The DOE templates provide common 2-level designs for 2 to 5 factors. These basic templates are ideal for training, but use SigmaXL >...
Read more >
Tutorial (intermediate): Hosting experiments online • psychTestR
psychTestR experiments can be hosted online using the open-source 'Shiny Server' software. This software can be installed on a Linux server.
Read more >
Design an Experiment Template | AST
This template can be used by students to 1) help give them choices about what kind of investigation to do, 2) make sure...
Read more >
Design of improved membrane protein production experiments
Here, we describe a study to examine the reasons for successes and failures in recombinant membrane protein production in yeast, at the level...
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