github / rest-api-description

An OpenAPI description for GitHub's REST API
MIT License
1.34k stars 215 forks source link

[Schema Inaccuracy] the /repos/{owner}/{repo}/releases/latest endpoint can return a 404 #3726

Open ae-ou opened 2 weeks ago

ae-ou commented 2 weeks ago

Schema Inaccuracy

The /repos/{owner}/{repo}/releases/latest endpoint returns a 404 if you call it against a repository that has no releases (e.g. a newly created repo). The documentation for this endpoint only lists 200 as a potential response code.

This data block is also returned in the event of a 404:

{
    message: 'Not Found',
    documentation_url: 'https://docs.github.com/rest/releases/releases#get-the-latest-release',
    status: '404'
}

It's worth noting that the page that the documentation_url points to doesn't mention 404 response codes.

Expected

The documentation should list 404 as a possible response code.

Reproduction Steps

  1. Find a repo that has no releases against it, or create a brand new repo for the sake of testing.
  2. Call the endpoint (populate the owner and repo path placeholders, and pass in an API token if the repo is private).
  3. Observe that a 404 response is returned.
shiftkey commented 1 week ago

@ae-ou thanks for the report! I've reached out to the team who maintains that API to confirm this is behaviour that should be documented.