Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Schema Inaccuracy] Fetching Issues, redirects to Pull Requests instead #3506

Closed
Jonas56 opened this issue Apr 6, 2024 · 2 comments
Closed

Comments

@Jonas56
Copy link

Jonas56 commented Apr 6, 2024

Schema Inaccuracy

When fetching issues for the rails project using the GitHub API, the html_url provided in the API response incorrectly redirects to a pull request URL rather than the expected issue URL.

Expected

For an issue fetched from the GitHub API, the expected html_url format should directly link to the issue page on GitHub, following the pattern:

Expected URL Format: https://github.com/rails/rails/issues/<issue_id>

The actual URL format in the API response is:

Actual URL Redirect: https://github.com/rails/rails/pull/<issue_id>

Reproduction Steps

  1. Use the GitHub API to fetch issues related to the Rails project (e.g., curl -X GET https://api.github.com/repos/rails/rails/issues).
  2. Inspect the html_url field in the API response for any issue.
@Jonas56 Jonas56 changed the title [Schema Inaccuracy] Fetching Rails Issues, redirects to Pull Requests instead [Schema Inaccuracy] Fetching Issues, redirects to Pull Requests instead Apr 6, 2024
@shiftkey
Copy link
Member

@Jonas56 thanks for the feedback! There's a note in the documentation that describes more about this historical context:

Note: GitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key. Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.

Due to compatibility reasons we've had to keep this behaviour around, but there's extra context in there about how to identify these PRs.

@Jonas56
Copy link
Author

Jonas56 commented Apr 12, 2024

Thanks for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants