[BUG] Cannot convert from nullable to string for x-ms-parameterized-host enum backing struct when used in RawRequestUriBuilder in generated RestClient #1376
Labels
v3
Version 3 of AutoRest C# generator.
Describe the issue or request
Usecase:
x-ms-parameterized-host
is used with enum, declaration:Source:
https://github.com/propheel/azure-rest-api-specs/blob/dev-maps-Microsoft.Maps-2.0-versioning-test/specification/maps/data-plane/Common/preview/1.0/common.json
https://github.com/propheel/azure-rest-api-specs/blob/dev-maps-Microsoft.Maps-2.0-versioning-test/specification/maps/data-plane/Render/preview/2.0/render.json
This generates a perfectly valid backing struct:
Geography.cs
The issue appears though with regards to generated RestClient:
dotnet --version: 5.0.301
platform: WSL2/Ubuntu 20.04
Autorest command:
Describe your ideas for solutions
I am using a rather sample hotfix to alleviate the above to replace
geography.Value
withgeography.ToString()
:Which will result in the following URI produced:
https://.atlas.microsoft.com/
in the case when geography is null, which might not be overall the best approach, though this should not happen as the generated constructor has the elvis assignment present:geography ??= Geography.Us;
To reproduce:
The text was updated successfully, but these errors were encountered: