Closed msyyc closed 4 months ago
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
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.
opened discussion for TCGC: https://github.com/Azure/typespec-azure/issues/846
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 |
Swagger m4 Python
"XXX": {"type": "object"}
anyObject
JSON
"XXX": {}
any
Any
please help to confirm the python behavior @msyyc @iscai-msft @lmazuel @johansteTypeSpec TCGC Python
{}
anonymous model with no propertiesAny
model EmptyModel {}
named model with no propertiesclass EmptyModel: ...
unknown
any
Any
I confirm current python emitter behavior is same as your comment
After discussion, we decide to keep current behavior
Compared with SDK between typespec and swagger, typespec definition has a model which has no property:
typespec sdk
swagger sdk