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

Confusing ref format mismatch between updateReference vs createReference #7

Closed
billytrend opened this issue Oct 3, 2018 · 7 comments
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Bug Something isn't working as documented

Comments

@billytrend
Copy link
Contributor

updateReference takes a partially qualified ref { ref: "tags/x" ... } because it is interpolated into PATCH /repos/:owner/:repo/git/refs/:ref

createReference takes a fully qualified ref { ref: "refs/tags/x" ... } because it is passed in the body of a request

This also affects other ref operations.

The difference here is very confusing and has caught me out a couple of times. Is there a way I can manually update the docs to highlight this?

Thanks

@gr2m
Copy link
Contributor

gr2m commented Oct 3, 2018

Hey there, thanks for opening the issue. The docs cannot be updated manually right now, the endpoint methods are based on the REST API docs at https://developer.github.com/v3

This is something I’ve run into in the past myself. I think I brought it up with the docs/API team before, I think there was a legid reason for why it is the way it is, but I agree that it could at least be mentioned in the docs. Let me look into it again

@billytrend
Copy link
Contributor Author

Well the behaviour makes complete sense to me from the sdk codegen point of view since the create request is explicitly defined as /refs/:ref and I'd imagine you extract url variables programmatically into fields? Not sure there would be a good way of automating around this unless you have some ability to manually override the code that is produced.

@gr2m
Copy link
Contributor

gr2m commented Oct 5, 2018

I will check in with the REST API team to see if we can skip the /refs prefix for the "Create a reference" endpoint.

I’ve looked trough the routes and these are the ones that include a ref parameter. I’m sure the API/docs could be more consistent here, I’ll discuss it with the docs/API team

ref can be SHA, branch name, or a tag name

ref must be heads/branch-name, not just branch-name

Not mentioned in the docs, but I assume

ref must be a fully qualified reference (ie: refs/heads/master)

unclear

Will ask API team to clarify :)

@stale
Copy link

stale bot commented Nov 2, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@bcoe
Copy link

bcoe commented May 20, 2019

I was fairly confused by this myself; am I following that this is expected behavior, but the difference in behavior is not reflected in docs?

@gr2m
Copy link
Contributor

gr2m commented May 26, 2020

I tested the GET /repos/:owner/:repo/commits/:ref endpoint and it looks like the handling changed,ref can be any of the following

  • a commit sha
  • a branch name
  • heads/<branch name>
  • refs/heads/<branch name>
  • a tag name
  • tags/<tag>
  • refs/tags/<tag name>

The same is true for

I'd appreciate help with testing the remaining API endpoints

I tested POST /repos/:owner/:repo/git/refs: the ref parameter must be a fully qualified reference name, but that is documented and the server responds with a helpful error if it's not. But I do wonder why that is, and if the handling could be adjusted to accept a "ref" without the refs/ prefix.

@gr2m gr2m transferred this issue from octokit/octokit.js Apr 18, 2021
@gr2m
Copy link
Contributor

gr2m commented Apr 18, 2021

Closing this issue due to inactivity and outdated docs/links. If there is still anything actionable left, let's discuss it here:
https://github.com/octokit/octokit.js/discussions

@gr2m gr2m added Status: Blocked Some technical or requirement is blocking the issue Type: Bug Something isn't working as documented labels Apr 18, 2021
@gr2m gr2m closed this as completed Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

3 participants