Skip to content

Add support for Servers object from OpenAPI schema #10

@DefCon-007

Description

@DefCon-007

OpenAPI supports listing available servers via Server Objects. We could provide users a type-safe way of configuring their client toward e.g. a specific environment.
Given the following server objects:

[
  { "url": "https://dev.megacorp.evil/", "description": "Evil Development Server" },
  {
    "url": "[https://megacorp.evil/{format}](https://megacorp.evil/%7Bformat%7D)",
    "description": "Evil Production Server",
    "variables": {
      "format": {
        "default": "json",
        "enum": [
          "json",
          "xml"
        ]
      }
    }
  }
]

Types could look like this:

type Server = `https://dev.megacorp.evil/` | `[https://megacorp.evil/${](https://megacorp.evil/$%7B)"json" | "xml"}`
export const getMegacorpAPI = (server: Server) => {
  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions