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

Feature: Support GitHub REST API versioning #9

Closed
tisonkun opened this issue Nov 29, 2022 · 6 comments · Fixed by #73
Closed

Feature: Support GitHub REST API versioning #9

tisonkun opened this issue Nov 29, 2022 · 6 comments · Fixed by #73
Labels
enhancement New feature or request Rest API

Comments

@tisonkun
Copy link

See also https://docs.github.com/en/rest/overview/api-versions

@yanyongyu it can be a thing that GitHub versions its API endpoints :)

@yanyongyu
Copy link
Owner

The versioning of rest-api can be hard to support until the github/rest-api-description support it. Changing the rest api version will cause model definitions and client methods to change.

@yanyongyu yanyongyu added enhancement New feature or request wontfix This will not be worked on Rest API labels Nov 29, 2022
@yanyongyu yanyongyu changed the title Prepare for GitHub API versions Feature: Support GitHub REST API versioning Nov 29, 2022
@yanyongyu yanyongyu removed the wontfix This will not be worked on label Dec 21, 2022
@yanyongyu
Copy link
Owner

https://github.com/github/rest-api-description/ has added versioned schema.

@netomi
Copy link
Contributor

netomi commented Mar 31, 2023

At least provide a way to specify the X-GitHub-Api-Version header via a config that will be used for the rest requests or hard-code it to the version that githubkit currently supports.

https://docs.github.com/en/rest/overview/api-versions?apiVersion=2022-11-28

@yanyongyu
Copy link
Owner

yanyongyu commented Mar 31, 2023

githubkit currently does not specify a rest api version and github will use the default version. But githubkit now generates the model using the latest schema instead of 2022-11-28. We may change this behavior first.

@netomi
Copy link
Contributor

netomi commented Mar 31, 2023

If you would fix the api version that is used to generate the model and then access with the github rest api, your released versions of your library are resilient to any change that is made on github side.

Now, the latest version 0.9.8 is generated using the current schema 2022-11-28. When github bumps the version to a new one, githubkit will try to access the latest api with a model that matches 2022-11-28. which will eventually fail. If you match the model with the actual api version and add the corresponding X-GitHub-Api-Version header for each request, any released version of the library will continue to work (unless GitHub decides to drop the version completely ofc).

@yanyongyu
Copy link
Owner

Due to #11, the core logic of codegen may change. For now, i would like to add the version tag to codegen and output the version header in client request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Rest API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants