microsoft / microsoft/typespec
Incorrect serialization Code is Generated For Extensible Enums of Union Type
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
When an union model property type is customized to an extensible enum of more than 1 type, ie `public readonly partial struct HyperparameterCycleCount : IEquatable, IEquatable` the underlying model is generating deserialization code that doesn't compile.
.
Similarly, the serialization code is generated incorrectly.
Sample spec: https://github.com/mikhail/openai-in-typespec/blob/c22818b1e6d61ffde44d19501e0ebacb13559eb9/.typespec/fine-tuning/custom.tsp#L5.
Sample generated code: https://github.com/mikhail/openai-in-typespec/blob/c22818b1e6d61ffde44d19501e0ebacb13559eb9/.dotnet/src/Generated/Models/HyperparameterOptions.Serialization.cs#L97
Contributor guide
Assessment
This issue has not been assessed yet.