You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, without association with an operation, we cannot definitely know whether the serialization for the model be (JSON? or XML? or None).
We can do None and generate a model that does not support any type of serialization, but this likely not what service wishes.
I would think service typically want JSON.
Current TCGC will not have a serializationOptions for property in such model.
If emitter interprets them as JSON, it had to use property.__raw?.name. See #2118 (comment)
Do we default the serialization to JSON for an orphan model? Or do we require service always add a e.g. @usage(output | json) or @mediaType("application/json") to the model?
The text was updated successfully, but these errors were encountered:
First, it doesn't have to be a problem in the first place. A model describes a model, and serialization is another layer of usage of this model. IOW, there could be a design where the model is serializationn-agnostic, and conceptually you could do:
serializeXML(model) // get a XML tree
serializeJSON(model) // get a JSON tree
So that's a design choice to tight a model to a serialization, and it doesn't have to be necessary, it's not a curse :).
Now, assuming that a given language has tight serialization to their model, yes we should consider JSON the default, as factually, this is 99% of our usages. Even more, we don't know any situation today, where a model-only generation is expected to work with XML.
Agreement is that by default, orphan model should support JSON serialization.
We can consider
default-serialization-format=json emitter option for models (that made "public") not associated to an op.
In future, about how we can let service say "I want XML instead", or "I want JSON and XML", or maybe "I don't want serialization on the model" (not sure whether this be useful).
i prefer to add a default to SerializationOptions. languages could choose their own fallbacks. we could think about how to add serialization indicator for orphan model in the future.
Context:
There were tons of model not used by operation in eventgrid (and maybe other services), that need be generated in SDK via
access=public
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents/Microsoft.Storage/client.tsp
However, without association with an operation, we cannot definitely know whether the serialization for the model be (JSON? or XML? or None).
We can do None and generate a model that does not support any type of serialization, but this likely not what service wishes.
I would think service typically want JSON.
Current TCGC will not have a
serializationOptions
for property in such model.If emitter interprets them as JSON, it had to use
property.__raw?.name
. See #2118 (comment)Do we default the serialization to JSON for an orphan model? Or do we require service always add a e.g.
@usage(output | json)
or@mediaType("application/json")
to the model?The text was updated successfully, but these errors were encountered: