-
Notifications
You must be signed in to change notification settings - Fork 82
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
[MPG] Empty models in tsp, what should we generate #2779
Comments
From code-model point of view, it is. The generated code-model is the same. Though TCGC's result contains
I'm not sure if TCGC has a way to represent Likely they will use |
Discussion here: Azure/typespec-azure#846 (comment)
@weidongxu-microsoft Guess for TypeSpec greenfield in MPG, we treat anonymous/named empty model as empty class. While for brownfields(since by default they convert |
I think for tsp, empty model generate empty class. Compatibility with brownfield is another topic. And we may not need exact same result (one reason is that m4 don't return empty model in the first place, and we likely won't solve that). |
Makes sense.
And do a case by case for brownfields in the future. |
tsp: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure/main.tsp#L314-L315
converted swagger: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/devopsinfrastructure.json#L1511-L1514
TCGC issue: Azure/typespec-azure#846
copied from the issue:
{"type": "object"}
anyObject
{}
{"type": "object"}
anyObject
model EmptyModel {}
{}
any
unknown
any
Considerations:
We probably need to check what code-model would it be, if it is
Is it only anonymous model vs named model? Do we want to generate them both as empty class (DPG would do this)?
And can we distinguish this "empty model" from typespec, from e.g. "type": "object" from Swagger?
The text was updated successfully, but these errors were encountered: