Skip to content

Inherit SubResource and WritableSubResource from resourcemanager instead of replace the types #2216

Open

Description

To keep the ability of expanding new properties, we could make the model that would be replaced by SubResource or WriteableSubResource inheriting them instead of replacing

Now we have "safe flatten" in mgmt plane which will automatically flatten the properties with a type of "single property" class. But this does not work when the property is a list of a "single property" class, for instance, a property

public IList<WritableSubResource> Subnets {get;}

here the WritableSubResource here is not its actual type, it is replaced by the generator. When a new property is added to the element in swagger, the replacement will no longer apply therefore we will get a breaking change now.
If we could make the replacement in this way: we generator the class without replacing it, but let it inherit from SubResource or WritableSubResource, the SDK will end up in this way:

public IList<SubnetInfo> Subnets {get;}

public partial class SubnetInfo : WritableSubResource {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

MgmtThis issue is related to a management-plane library.feature-requestThis issue requires a new behavior in the product in order be resolved.v3Version 3 of AutoRest C# generator.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions