-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Update Autorest C# #11305
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
Update Autorest C# #11305
Conversation
| <_SupportsCodeGeneration Condition="'$(IsClientLibrary)' == 'true'">true</_SupportsCodeGeneration> | ||
| <_DefaultInputName Condition="Exists('$(MSBuildProjectDirectory)/autorest.md')">$(MSBuildProjectDirectory)/autorest.md</_DefaultInputName> | ||
| <AutorestInput Condition="'$(AutorestInput)' == ''">$(_DefaultInputName)</AutorestInput> | ||
| <AutorestConfiguration Condition="'$(AutorestConfiguration)' == '' AND '$(AutorestInput)' != '$(_DefaultInputName)'">$(_DefaultInputName)</AutorestConfiguration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this feature. Autorest now supports including remote config into a local one.
|
|
||
| namespace Azure.Search.Documents.Models | ||
| { | ||
| [CodeGenSuppress(nameof(SynonymMap), typeof(string), typeof(string))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't suppress generated ctors any more if you have a custom one so this have to be done manually.
heaths
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sampling of Search and general changes LGTM, though a couple of questions.
| { | ||
| public static HttpPipeline Build(TokenCredential credential, ClientOptions options) | ||
| { | ||
| return HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, "https://management.azure.com//.default")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not a big deal since they usually get canonicalized, but did you mean for two "//" here toward the end of the URI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, actually @schaabs told me to do it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not technically a URI it's a scope string, which has to be exact. Since the resource string registered with AAD, "https://management.azure.com/", ends in a "/" the default scope has the two "//", "https://management.azure.com//.default". It's unfortunate because it's inconsistent between services, and is dependent on how the resource was registered with AAD. For instance the resource for key vault is "https://vaults.azure.net" doesn't end in a "/" so its default scope, "https://vaults.azure.net/.default" does not have the double slashes.
| public override bool Equals(object obj) => obj is AnalyzerName other && Equals(other); | ||
| /// <inheritdoc /> | ||
| public bool Equals(AnalyzerName other) => string.Equals(_value, other._value, StringComparison.Ordinal); | ||
| public bool Equals(AnalyzerName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were the extensible enum struct guidelines updated? This is a change from them. It was intentional, but open for change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guidelines don't define any comparison. There is a sample that uses Ordinal but it's not explicitly mandated. https://azure.github.io/azure-sdk/dotnet_implementation.html#dotnet-enums
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know - I wrote that after discussing the finer points with the team. :) We should be consistent across implementations. If we're going to accept case-insensitive parsing, we should do so at least by default across implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Thanks Pavel! |
tg-msft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Also, if anyone knows how to tell linguist to expand everything in the github PR view, that would be a nifty trick for these PRs where I want to just keep scrolling.
| array.Add(TokenInfo.DeserializeTokenInfo(item)); | ||
| if (item.ValueKind == JsonValueKind.Null) | ||
| { | ||
| array.Add(null); | ||
| } | ||
| else | ||
| { | ||
| array.Add(TokenInfo.DeserializeTokenInfo(item)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a problem with this - but any reason not to pass it into the DeserializeTokenInfo method and let it handle how it chooses to interpret null? If we're going to make it possible to customize Deserialize methods down the road (if we don't already), it might be nice to also customize how null gets handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea I haven't considered doing it this way yet. Not sure I want to change it before we have use cases but I'll keep it mind.
Using Refined Github extension you can alt+click on Load diff text and all would get expanded. |
|
I have on my personal backlog to push a PR to github.vscode-pull-request-github to allow it to handle system URI monikers (Code supports this) and then write a simple browser extension to add an "Open in Code" button, similar to what AzDO has for VS. But if someone got to this first...cool. |
|
If only VS code Github review didn't have 300 file count limit.. |
|
Is that only if reviewing the PR itself vs. checking out the branch? I thought the latter was possible for larger PRs (and provides more context). |
|
Only for PR review feature. For checkout it uses git so that works fine. |
Minor naming and serialization changes.
Additional CodeGenMember attributes:
Initialize - to always initialize members see https://github.com/Azure/autorest.csharp/blob/feature/v3/test/TestProjects/SerializationCustomization/AlwaysInitializeTestClass.cs#L11
EmptyAsUndefined to avoid serializing empty collections https://github.com/Azure/autorest.csharp/blob/feature/v3/test/TestProjects/SerializationCustomization/EmptyAsUndefinedTestModel.cs#L11
Bug fix for FormRecognizer overloads.
Time type support.