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
I finally had some time to follow it a bit down the road of what needs to be in place to do this. And to be honest, I think (as it would be expected) XML and JSON are not exactly from the same planet 😬
What I discovered so far:
Code generation side fits well (of course)
Binding side is not a clean fit, some examples:
List or single value per field: string | array gets the scalar flag, and ["x"] comes back as "x".
Absent vs. null: XML has no difference, so JSON needs Unset plus a NULL marker, and the XML serializers would write Unset.UNSET.
Values converted through text: "1" becomes 1.0 and "true" becomes True, so JSON needs the strict flag.
and so on and so forth ...
In the end this will boil down to a lot of changes and probably be hard to maintain to keep the XML part as good and solid as it is in the moment.
One way would be to base on xsdata as a library and reuse the analyzer and writer.
However, some things need to be more pluggable in xsdata to allow that:
a registry for resource types in ResourceTransformer (today hard coded TYPE_*)
extension of the intermediate representation extension point instead of the named Attr flags (e.g. one metadata mapping written into field metadata)
field metadata keys passed through XmlVarBuilder instead of only known keys
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
As I once asked this #1069
I finally had some time to follow it a bit down the road of what needs to be in place to do this. And to be honest, I think (as it would be expected) XML and JSON are not exactly from the same planet 😬
What I discovered so far:
In the end this will boil down to a lot of changes and probably be hard to maintain to keep the XML part as good and solid as it is in the moment.
One way would be to base on xsdata as a library and reuse the analyzer and writer.
However, some things need to be more pluggable in xsdata to allow that:
What do you think?
All reactions