-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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# - IOT #13558
Update Autorest C# - IOT #13558
Conversation
/// <summary> | ||
/// Helper functions for mutating the <see cref="ExportImportDevice"/> instance. | ||
/// </summary> | ||
internal static class ExportImportDeviceExtensions |
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.
Was this class handcrafted, or generated by autorest?
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.
Handcrafted.
ImportMode = ExportImportDeviceImportMode.Create | ||
}); | ||
}.WithTags(x.Value.Tags).WithPropertiesFrom(x.Value.Properties).WithParentScopes(x.Key.ParentScopes)); |
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.
As per # 1: So this is because these fields, being collections, are readonly by default, and so they need additional helper methods?
https://github.com/pakrym/azure-sdk-for-net/blob/pakrym/update-generator-IOT/sdk/iot/Azure.Iot.Hub.Service/src/Generated/Models/ExportImportDevice.cs
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.
Correct.
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 see, what was the driving force behind this change? Should collections not be settable?
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.
The following guideline:
❌ DO NOT provide settable collection properties.
Users can replace the contents of the collection by clearing the collection first and then adding the new contents.
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.
This class can probably be internal. Will check and let you know. If it is internal, we would not need the extensions right?
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'm not sure I understand why not. We would still need to create instances of this class and the code-gen for properties doesn't change depending on the class being internal or not.
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.
And I want to add here that this is still work in progress and we are yet to make some classes internal which we do not expose. Just curious, is there something you use to be able to detect these in the API surface?
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'll go through the Model types, as we work on the APIs, and make necessary changes.
Contributes to #13511
Major features
x-ms-client-name
honored.modelAsString
enums are generated as types, they were string constants before.What you might need to do: