open-api icon indicating copy to clipboard operation
open-api copied to clipboard

error parsing server url with variable in protocol

Open giowe opened this issue 5 years ago • 1 comments

this is my actual server key in the open api definition:

servers: [
    {
      url: "{protocol}://{environment}/{version}",
      variables: {
        protocol: {
          default: "https",
          enum: [
            "http",
            "https"
          ]
        },
        environment: {
          default: "api.myapi.io",
          enum: [
            "api.myapi.io",
            "api-staging.myapi.io",
            "localhost:8000"
          ]
        },
        version: {
          default: "v1",
          enum: [
            "v1"
          ]
        }
      }
    }
  ],

changing protocol variable with an http or an https it works perfectly ( url: "https://{environment}/{version}"); it's very important to have the protocol as variable cause i'm importing this definition into Postman and when I test locally i need to quickly switch from https to http.

giowe avatar Jan 12 '20 11:01 giowe

feel free to open a pr

jsdevel avatar Jan 13 '20 17:01 jsdevel