Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
32 stars 80 forks source link

[MPG] Empty models in tsp, what should we generate #2779

Open XiaofeiCao opened 1 month ago

XiaofeiCao commented 1 month ago

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: https://github.com/Azure/typespec-azure/issues/846 copied from the issue: Swagger m4 TypeSpec TCGC
{"type": "object"} anyObject {} anonymous model with no properties
{"type": "object"} anyObject model EmptyModel {} named model with no properties
{} any unknown any

Considerations: We probably need to check what code-model would it be, if it is

  1. {} from tsp
  2. model Model {} from tsp 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?