Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set Setting Server Template Variables? #2887

Open
ItsReddi opened this issue Mar 15, 2023 · 0 comments
Open

How to set Setting Server Template Variables? #2887

ItsReddi opened this issue Mar 15, 2023 · 0 comments

Comments

@ItsReddi
Copy link

  • Swagger-Client version: latest
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger/OpenAPI definition:

"servers": [
    {
      "description": "environment",
      "url": "{protocol}://{server}",
      "variables": {
        "protocol": {
          "enum": [
            "http",
            "https"
          ],
          "default": "https"
        },
        "server": {
          "enum": [
            "some.production.domain/api",
            "some.other.domain/otherapi"
          ],
          "default": "some.production.domain/api"
        }
      }
    }
  ]

Swagger-Client usage:

client = new SwaggerClient({
      url: "https://url-to-swagger.json",
      servers: {
        protocol: "http",
        server: "some.other.domain/otherapi",
      }
    ...options
})

How can we help?

The Problem is, that the server template variables are not set. Only the default will be used.
Specification: https://swagger.io/docs/specification/api-host-and-base-path/

There is something mentioned on per OAS Tag that modifying the server is possible there.
But how to set the template variables globally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant