-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Proposal: metadata file for endpoints #2908
Comments
I would like to work on a proof-of-concept PR for this. There is a risk that this looks like a good idea but it ends up adding more complexity than it returns in value. |
Are YAML and JSON our only two options? |
Hey, @WillAbides - I love this proposal... it looks like you might be automating me out of a (volunteer) job... or at the very least, giving me longer vacations from said job. Seriously though, I'm a big fan of automation, and this sounds very cool indeed. |
You mean for the metadata file? Probably not, but I would prefer yaml or json because they are well known formats that show up nice in most editors. I've been looking for an excuse to use cuelang, but I wouldn't want to add something new to the cognitive load of understanding go-github.
Hopefully only the thankless parts of the job. |
OK, cool. SGTM regarding YAML.
|
Contributing to and maintaining this repo could be helped by a metadata file for all of the endpoints go-github supports. It would map to GitHub's OpenAPI descriptions. In this proposal I'll call it
operations.yaml
.An
operations.yaml
entry might look like:operations.yaml
could be updated by a scheduled GitHub action that opens a PR when it finds a change.Initially
operations.yaml
would be useful forupdate-urls
. Instead of having to resolve every documentation url, it could use the value stored inoperations.yaml
.update-urls
could be expanded to also update godoc with the summary field.It would also be useful for finding new endpoints for go-github to support. Eventually we could write a generator that uses
operations.yaml
to generate the boilerplate to implement new endpoints.Overrides
There are probably endpoints where we don't want to use the OpenAPI data or maybe some that aren't even in the OpenAPI description. For those cases we can create an
override
section:For an endpoint that doesn't exist in the OpenAPI description, we create an entry with no
openapi
section and all required fields set inoverride
. Here's a fictional PUT endpoint for the same url as above.Multiple OpenAPI Descriptions
So far I've been talking about "the" OpenAPI description, but there are several docs published:
We will need a way to reconcile these. Knowing how GitHub generates these, I doubt there will be any significant differences between versions for the same
operation_id
. However they will have different documentation URLs. We can reconcile which one to use by taking the first one where theoperation_id
exists in this order: api.github.com -> ghec -> ghes versions in descending order -> maybe github.ae if anybody ever asks for it.The text was updated successfully, but these errors were encountered: