Skip to content

How to set Setting Server Template Variables? #2887

Closed
@ItsReddi

Description

@ItsReddi
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions