Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPG][Diff] SDK from Typespec still generate model when model defines no property #2586

Open
msyyc opened this issue May 13, 2024 · 4 comments
Assignees
Labels

Comments

@msyyc
Copy link
Member

msyyc commented May 13, 2024

Compared with SDK between typespec and swagger, typespec definition has a model which has no property:

image

  • typespec sdk
    image
    image

  • swagger sdk
    image

@iscai-msft
Copy link
Contributor

Python is in an interesting situation, where since our models are also a dictionary type, it wouldn't be breaking for us if we took empty models and generated them as dictionaries, then when later properties were added we would generate a model. I don't think tcgc should return empty models as dictionaries, but I could be open to python generating these empty models as dictionaries. However, I still think it's better to not do any magic here: is it breaking mgmt if we just return empty models? I don't believe it is bc our models are dictionaries

@msyyc
Copy link
Member Author

msyyc commented May 15, 2024

I don't think it is a problem for Python, either. Since we only release SDK from typespec for green field service, it is not breaking for python. I agree that we just keep current logic.

@tadelesh
Copy link
Member

opened discussion for TCGC: Azure/typespec-azure#846

@tadelesh
Copy link
Member

tadelesh commented May 31, 2024

Swagger m4 Python
"XXX": {"type": "object"} anyObject JSON
"XXX": {} any Any

please help to confirm the python behavior @msyyc @iscai-msft @lmazuel @johanste

TypeSpec TCGC Python
{} anonymous model with no properties Any
model EmptyModel {} named model with no properties class EmptyModel: ...
unknown any Any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants