Azure / autorest.csharp

Extension for AutoRest (https://github.com/Azure/autorest) that generates C# code
MIT License
142 stars 166 forks source link

[defect]System.InvalidOperationException: Unable to find object property with serialized name 'value' in schema SavingsPlanModelListResult #4975

Closed chunyu3 closed 3 months ago

chunyu3 commented 3 months ago

When generate billing\Azure.ResourceManager.Billing sdk (target package: package-2024-04), the generate fail. error:

fatal   | System.InvalidOperationException: Unable to find object property with serialized name 'value' in schema SavingsPlanModelListResult
     at AutoRest.CSharp.Output.Models.Types.SchemaObjectType.GetPropertyBySerializedName(String serializedName, Boolean includeParents) in D:\a\_work\1\s\autorest.
csharp\src\AutoRest.CSharp\Common\Output\Models\Types\SchemaObjectType.cs:line 679
chunyu3 commented 3 months ago

root cause:

SavingsPlanModelListResult inheritance from SavingsPlanModelList, when GetPropertyBySerializedName for SavingsPlanModelListResult, it set includeParents=false to ignore parenents, as a result it cannot find the property named value.

https://github.com/Azure/autorest.csharp/blob/1a396fc451a93d73eab9824782efda60951ec027/src/AutoRest.CSharp/Common/Output/Models/Requests/PagingResponseInfo.cs#L40

ArcturusZhang commented 3 months ago

why this is flagged with dpg when the issue happens to a mgmt library?

chunyu3 commented 3 months ago

t set includeParents=false

Actually it is in common when handle PagingResponse, the ModelTypeProvider also ignore parents. DPG should also has this problem also. Need investigation.