Open ArcturusZhang opened 2 weeks ago
Since typespec does not support this yet, we cannot have a cadl-ranch case for this, but for us, we could always construct the input types for this scenario and get the generated code, and maybe verify the serialization and deserialization to validate they are working properly which should be close enough for what a cadl-ranch test case could validate.
There is a scenario in swagger world that we could have the types as following:
but the typespec now does not support this yet because of the type constraint in
kind
inA
.Since it is a goal for our generator, we still need to have the ability to support swagger input, in a way that we will write a tool or something to convert the swagger into
tspCodeModel.json
and then let our generator to consume it, therefore our input types should still be able to represent this scenario that typespec currently does not support.As for the generated code of this, one proposal is like the following:
This solution is:
kind
(or an extra internal ctor just like we have the protected)The other alternative solution is that we could do the autorest.csharp way: making the discriminator property internally settable