Add api version in ClientOptions and policy inside generated client#2561
Merged
qiaozha merged 20 commits intoAzure:mainfrom Jun 26, 2024
Merged
Conversation
qiaozha
commented
Jun 7, 2024
joheredi
reviewed
Jun 7, 2024
joheredi
reviewed
Jun 7, 2024
joheredi
approved these changes
Jun 7, 2024
Member
joheredi
left a comment
There was a problem hiding this comment.
Looks great, left a comment on how to avoid that createClient causes side effects, should be easy to address. Please consider taking the suggestion
qiaozha
commented
Jun 12, 2024
joheredi
reviewed
Jun 18, 2024
joheredi
approved these changes
Jun 18, 2024
xirzec
approved these changes
Jun 20, 2024
Member
xirzec
left a comment
There was a problem hiding this comment.
Looks good, just two minor remarks. 👍
qiaozha
commented
Jun 20, 2024
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.
fixes Azure/azure-sdk-for-js#29883 and #2396 (comment) in favor of Azure/azure-sdk-for-js#29904
if there's no client level api version, we will:
which means we will not generate a property of apiVersion in the ServiceClientOptions interface.
which means, we will generate code
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });after createClient from core-client-rest.if there's no client level api version, we will add a warning
logger.warning("This client does not support client api-version, please change it at the operation level");if there's client level api version, but it's required, and it doesn't have a default value, apiVersion will be a positional argument for client factory function. we will ignore api version passed in options, and add a warning
logger.warning("This client does not support to set api-version in options, please change it at positional argument");ApiVersionPolicywill also be removed in this caseif there's no client level api version, we don't need to add this policy here, but if there's client level api version in the query position, according to [Deprecate]: deprecate apiVersion in ClientOptions from core-client-rest azure-sdk-for-js#29883 (comment) we will generate a new
ClientApiVersionPolicyin the client side, so that we can remove theApiVersionPolicyfrom core-client-rest in the future.Generate ApiVersion in Options: true
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: false
{ apiVersion = "default", …options }
Generate ApiVersion in Options: true
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: false
{ apiVersion = "default", …options }
Generate ApiVersion in Options: false
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: false
Options
logWarning: true
Generate apiVersion in options: true
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: false
{ apiVersion, …options }
Generate ApiVersion in Options: true
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: true
{ apiVersion = "default", …options }
Generate ApiVersion in Options: true
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: true
{ apiVersion = "default", …options }
Generate ApiVersion in Options: false
Remove ApiVersionPolicy: true
Add clientApiVersionPolicy: true
Options
logWarning: true
Generate apiVersion in options: true
Remove apiVersionPolicy: true
Add clientApiVersionPolicy: true
{ apiVersion, …options }