fix: honor explicit version in <api>:<version> syntax for unlisted services - #940
Open
JamCodex685 wants to merge 1 commit into
Open
JamCodex685 wants to merge 1 commit into
JamCodex685 wants to merge 1 commit into
Conversation
…services The CLI's own error message advertises `<api>:<version>` as an escape hatch for services not in the hardcoded SERVICES table, but parse_service_and_version always called resolve_service() unconditionally, which has no fallback and only matches that hardcoded list. The version parsed out of the colon syntax was silently discarded whenever the service name was not already a known alias, so the advertised syntax never actually worked for anything unlisted. The Discovery-document fetch underneath is already generic over arbitrary (service, version) pairs, so the fix falls back to treating the literal strings as a Discovery API name/version pair when resolve_service fails and the colon syntax was used, instead of propagating the error. Adds 3 unit tests covering: a colon-qualified unlisted service now resolving, a known alias still resolving via the existing path (no regression), and an unlisted service WITHOUT a colon still erroring (no accidental loosening of validation).
🦋 Changeset detectedLatest commit: 8e1bed0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Reopening as a new PR — the original (#927) was auto-closed by the stale-PR bot after 72 hours of no maintainer activity, not rejected. All CI was green and the CLA was signed before the close. See #927 for full history/discussion.
Summary
parse_service_and_versionrejected<api>:<version>syntax for services not in the hardcodedSERVICEStable, even though the discovery-based fetch path supports arbitrary API names. This blocked using e.g.chromepolicy:v1(Chrome Policy API), which isn't in the table.Fix: when
resolve_servicefails to find the service in the table but the caller used explicit colon syntax, fall through to using the given API name/version directly instead of erroring.Testing
Added 3 unit tests covering: colon syntax for an unlisted service, existing known-service resolution (unchanged), and unknown service without colon syntax still erroring as before.
cargo test/clippy/fmtall pass.