tefra/xsdata

Please bring back support for optional lists

Closed this issue · 2 comments

Support was removed in 24.5

We have an application that converts between JSON and XML and have been using support for optional lists to translate between the two sides. We need this because in our context there is a semantic difference between setting a field to empty list and not setting the field at all.

Previously we had fields that looked like below that would correctly translate between our JSON schema and XML schema:

some_field: Optional[list[float]]] = field(default=None, metadata={"type": "Attribute", "tokens": True})

Now this is forbidden, and there's no note in the changelog as to the reason this should be so. Perhaps this was part of the refactor?

Please consider adding support for optional lists back into the annotation analyzer.

Yeah this was never officially supported, and was removed in a recent refactor, I will add it back

Thanks @lewiscabban-swordfish the update is on main!