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] Incorrect ref parameter specification for creating or updating references #2746

Open
qubitz opened this issue Jul 17, 2023 · 0 comments

Comments

@qubitz
Copy link

qubitz commented Jul 17, 2023

Schema Inaccuracy

Update a reference and Create a reference schemas incorrectly specify the requirements of the ref parameter.

Currently it says:

The name of the fully qualified reference to update. For example, refs/heads/master. If the value doesn't start with refs and have at least two slashes, it will be rejected.

Following these perimeter requirements leads to responses of "Reference does not exist".

Expected

The description of the ref parameter should be rewritten to almost match the parameter description of Get a reference. Something along the lines of:

Must be a branch name (heads/BRANCH_NAME) or tag name (tags/TAG_NAME). For more information, see "Git References" in the Git documentation.

Reproduction Steps

curl -L \
  -X PATCH \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/OWNER/REPO/git/refs/refs/tags/latest \
  -d '{"sha":"aa218f56b14c9653891f9e74264a383fa43fefbd","force":false}'

Notice the .../refs/refs/... above . While a human can easily avoid this duplication, it is hidden when interacting through abstractions such as:

octokit.rest.git.updateRef({
  owner: OWNER,
  repo: REPO,
  "refs/tags/latest",
  aa218f56b14c9653891f9e74264a383fa43fefbd,
  force: false
});

Happy to provide more details if necessary.

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