-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[TCGC] client type for TypeSpec empty model #846
Comments
Conclude all possible cases in the following table, example is in this playground:
@timotheeguerin could you help to confirm this is the right behavior for swagger/m4? Since swagger/m4 one expression could map several TypeSpec expression, for brown field service converting to TypeSpec, we will use the following mapping:
|
Agree with the mapping at the end, we shouldn't do any extra conversion bc of the possibility of breaking changes |
Decision: everything keeps the same, only in conversion tool, change anyObject in M4 to |
since typespec has more expression ability than swagger, we decided to use more accurate result when converting from swagger to typespec. if the conversion result is not the one service want, typespec author needs to change manually. |
although in m4 we treat |
Thanks. My takeaways is,
CMIIW. |
In modeler4, we have
anyObject
type to represent an empty model definition despite whether it is a named definition or not (see the type ofprop1
andprop2
for the following example). And most languages I believe will treat it asany
type.But in TypeSpec, we could clearly say a model is a named model without any properties or an anonymous model without any properties (type of
prop1
andprop2
).So, we need to get consensus on what type we should generate for TypeSpec empty model, and also it should support non-breaking change for brown field services.
Proposal:Introduce
anyObject
type in TCGC. Anonymous model without any properties will be converted toanyObject
. For now,unknown
is converted toany
in TCGC.Named model without any properties will be kept as a named model.
For brown field service, converter should always use anonymous model in TypeSpec without any properties to represent
anyObject
type in m4.cc: @Azure/dpg-devs
The text was updated successfully, but these errors were encountered: