Azure / autorest.csharp

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

Use the `UsageFlags` from TCGC directly in our emitter #4859

Open ArcturusZhang opened 2 weeks ago

ArcturusZhang commented 2 weeks ago

Fixes https://github.com/Azure/autorest.csharp/issues/4820 Fixes https://github.com/Azure/autorest.csharp/issues/4734

Description

This PR let our models to use the usageFlags from TCGC directly. Since the usage flags from TCGC is a bitmap which is a number, if we do nothing, the serialized tspCodeModel.json will have usage properties with integer values, which is not quite readable. Therefore an additional change is that I added a replacer to replace the number value usage to string during serialization. We could use similar way in the future to remove the __raw when we want to directly use the models from TCGC to serialize.

Checklist

To ensure a quick review and merge, please ensure:

Ready to Land?