api.github.com 版本 3 的 swagger 规范

The swagger specification for the api.github.com version 3

我需要使用 swagger-codegen 编写程序以在 Java 中生成存根,用于 api.github.com。

为此,我需要 api.github.com 的 swagger 规范作为输入:我在哪里可以找到它?

截至 2020 年 7 月,GitHub 在此处以 OpenAPI 3.0 格式发布其 REST API 定义:

https://github.com/github/rest-api-description


官宣:

OpenAPI Description of REST API

GitHub published a full description of its REST API in OpenAPI 3.0 specification compliant documents.

The GitHub OpenAPI description contains more than 600 operations exposed in our API.
For visual exploration of the API, you can load the description as a Postman Collection.
Programmatically, the description can be used to generate mock servers, test suites, and bindings for languages not supported by Octokit.

The description is provided under two formats.

  • The bundled version is preferred for most use cases as it makes use of OpenAPI components for reuse and readability.
  • For tooling that has poor support for inline references to components, we also provide a fully dereferenced version.

Quarterly releases of the description are available for GitHub Enterprise Server and GitHub Private Instances, with versions like v2.21. More frequent updates to the description will be available for GitHub.com.

This feature is offered in beta as open source with an MIT license, [in this repository github/rest-api-description.


APIs.guru OpenAPI directory 还包含 OpenAPI 2.0 格式的 GitHub REST API 的非官方定义,可能是最新的也可能不是最新的:
https://api.apis.guru/v2/specs/github.com/v3/swagger.json (JSON)
https://api.apis.guru/v2/specs/github.com/v3/swagger.yaml (YAML)