Repository navigation
refactor!: Rename InstallationTokenOptions and InstallationTokenListRepoOptions to ...Request types and pass them by value - #4700
Open
JamBalaya56562 wants to merge 1 commit into
Conversation
…stRepoOptions` to `...Request` types and pass them by value
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4700 +/- ##
=======================================
Coverage 98.64% 98.64%
=======================================
Files 203 203
Lines 19027 19027
=======================================
Hits 18769 18769
Misses 258 258 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates #3644.
BREAKING CHANGE:
InstallationTokenOptionsis renamed toCreateInstallationTokenRequestandInstallationTokenListRepoOptionsis renamed toCreateInstallationTokenListReposRequest;AppsService.CreateInstallationTokenandAppsService.CreateInstallationTokenListReposnow take them by value.Both methods use
POST /app/installations/{installation_id}/access_tokens, whose request body schema has only the optionalrepositories,repository_ids, andpermissions, so no fields are added or removed. The JSON tags are not changed either:CreateInstallationTokenListReposRequest.RepositoryIDskeeps sendingrepository_idswhen it is nil or empty, which is why the method was added in #3155 (for #3106). Sincescript/check-schema-fields.shnow checks this method and warns that the field has noomitzero, the field is added totools/schemafields/exceptions.txtwith that reason.With a value parameter, the zero value now sends a body instead of no body:
{}forCreateInstallationTokenand{"repository_ids":null}forCreateInstallationTokenListRepos, the same body as passing an empty struct before. I checked with a throwaway GitHub App (Metadata read, one selected repository) that no body,{},{"repository_ids":null}, and{"repository_ids":[]}all return the same 201 response, and that each token can access the same repositories (GET /installation/repositories).InstallationTokenOptionsandInstallationTokenListRepoOptionsare removed frombody-allowed-pointer-typesandbody-allowed-wrong-names, and the tests check the request body withtestJSONBody.The method names already start with the verb of the GitHub docs operation name ("Create an installation access token for an app"), so they are not renamed.
Verified locally:
go build ./...,go vet -tags integration ./test/integration/,examplemodule build,go test ./github/, generated files idempotent,custom-gcl0 issues, andscript/check-schema-fields.shreports nothing for these types. (It still reports the 4EnterpriseUpdateBudgetwarnings that master has since #4693; #4699 fixes them.)