-
Notifications
You must be signed in to change notification settings - Fork 325
Open
Labels
emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp
Description
In mgmt, we have a requirement to mitigate breaking changes regarding base type of a generated model, details
public partial class KeyVaultData : TrackedResourceDataThe customized base type is Azure.ResourceManager.Models.TrackedResourceData, which is not generated during the current generation.
But in MTG, we have the check to ensure the custom base type is either from input model or generated model.
Lines 250 to 267 in 9f01672
| // If the custom base type doesn't have a resolved namespace, then try to resolve it from the input model map. | |
| // This will happen if a model is customized to inherit from another generated model, but that generated model | |
| // was not also defined in custom code so Roslyn does not recognize it. | |
| if (string.IsNullOrEmpty(baseType.Namespace)) | |
| { | |
| if (CodeModelGenerator.Instance.TypeFactory.InputModelTypeNameMap.TryGetValue(baseType.Name, out var baseInputModel)) | |
| { | |
| baseType = CodeModelGenerator.Instance.TypeFactory.CreateCSharpType(baseInputModel); | |
| } | |
| } | |
| if (baseType != null && CodeModelGenerator.Instance.TypeFactory.CSharpTypeMap.TryGetValue( | |
| baseType, | |
| out var customBaseType) && | |
| customBaseType is ModelProvider customBaseModel) | |
| { | |
| return customBaseModel; | |
| } | |
| } |
I think the issue here is, we don't have a provider to represent such kind of type, such as InheritableSystemObjectModelProvider in mgmt.
Metadata
Metadata
Assignees
Labels
emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp