Visitar URL original
[Schema Inaccuracy] Servers option only documents the API can be accessed over HTTP with no sensible default · Issue #20 · github/rest-api-description · GitHub
The Wayback Machine - https://web.archive.org/web/20260201202253/https://github.com/github/rest-api-description/issues/20
Skip to content

[Schema Inaccuracy] Servers option only documents the API can be accessed over HTTP with no sensible default #20

@alasdairhurst

Description

@alasdairhurst

Schema Inaccuracy

This issue is related to the default and only server that is described in the document:

/servers/0/url
/servers/0/variables/hostname/default

servers:
- url: http://{hostname}
  variables:
    hostname:
      description: Self-hosted Enterprise Server or Enterprise Cloud hostname
      default: HOSTNAME

The two issues are:

  1. The server makes use of variables, however the described API only permits users to access the github API over HTTP and not (i presume) the recommended HTTPS protocol. The hostname itself is the only portion that the user is permitted to substitute. I could be wrong here.
  2. There's no sensible default provided, namely https://github.com. From the description, it seems like the API is only describing access to self-hosted enterprise servers and not the public github instance.

These are both issues mainly when generating an SDK from the OpenAPI doc. It requires manual user input to provide the github hostname, and even then is on the incorrect protocol. We can do better 👍

Expected

I expected github.com to be documented as the default server
I expected the OAS doc to describe access to a github deployment over https

This could be done in a couple of different ways which make little difference overall:

First, ensure that the protocol is flexible, either as a parameterised variable {protocol}://{hostname}, making the entire URL a configurable variable {url}, or add a second server with https://{hostname}

Second, setting github.com as the default server could be done either as the first server in the list:

servers:
- url: https://github.com
  description: Public GitHub server
- url: {url}
  description: Self-hosted Enterprise Server or Enterprise Cloud
  variables:
    url:
      description: Self-hosted Enterprise Server or Enterprise Cloud URL
      default: https://hostname

or setting the default value of the URL variable:

servers:
- url: {url}
  variables:
    url:
      default: https://github.com

Reproduction Steps

go to https://petstore.swagger.io/ and paste in https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/ghes-2.21/ghes-2.21.yaml

Have to manually configure server with github.com.

Note: the API does work over http after testing. You can ignore that part, or include https anyway if people prefer to access the github API that way without any redirects.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions