Remove apiVersion pipeline policy and move default apiVersion value to operation level#3702
Merged
JialinHuang803 merged 14 commits intoAzure:mainfrom Jan 30, 2026
Merged
Conversation
qiaozha
approved these changes
Jan 27, 2026
Member
qiaozha
left a comment
There was a problem hiding this comment.
overall looks good, just two minor comments.
joheredi
reviewed
Jan 27, 2026
Member
joheredi
left a comment
There was a problem hiding this comment.
Looks good to me, I'd like to change the dummy url though. See my comment, other than that I have no concerns with merging this PR
MaryGao
reviewed
Jan 28, 2026
| * @returns - the URL with the api-version query parameter set | ||
| */ | ||
| function addApiVersionToUrl(url: string, apiVersion: string): string { | ||
| const urlObj = new URL(url, "https://microsoft.com"); |
Member
There was a problem hiding this comment.
why do we require a base url parameter?
Member
Author
There was a problem hiding this comment.
I encountered azureCore.spec.ts this case, and an error was thrown if it's not an absolute URL. So I added it in case the input URL is relevant.
MaryGao
reviewed
Jan 28, 2026
MaryGao
reviewed
Jan 28, 2026
| /** The API version to use for this operation. */ | ||
| /** Known values of {@link KnownVersions} that the service accepts. */ | ||
| apiVersion: string; | ||
| apiVersion?: string; |
Member
Author
There was a problem hiding this comment.
context.apiVersion can be undefined since we don't apply the client default value to the client context anymore if user don't set the value.
MaryGao
approved these changes
Jan 29, 2026
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.
Summary
This pull request improves the handling of the
api-versionparameter, especially for long-running operations (LROs) and paged operations. It removes the use of custom pipeline policies for injectingapi-versionand instead ensures the parameter is consistently and correctly added to URLs as needed, and set the default apiVersion value at the operations instead of the client context.Changes
Remove the custom apiVersion pipeline policy:
apiVersionexplicitly where needed.apiVersionparameter, ensuring that polling and paging requests include the correct API version if provided.api-versionfrom URLs where necessary, such as when restoring pollers.Move the default apiVersion value to the operation level:
api-versionparameters with default values, ensuring defaults are respected when the parameter is not provided.apiVersionparameter to be optional in the generated client context interfaces.