Skip to content

adapter: add xml deserialization

Leon Mauritz Möller requested to merge feature/xml_deserialization into master

This MR merges feature/xml_deserilization into master. It comes with deserialization tests and serialize + deserialize tests, just like the json module.

There's just one thing left to discuss, the problem I also mentioned in yesterday's meeting:
I'm using a TypedDict to pass the modeling kind of submodels and submodel elements to the respective constructor only when it's specified in the xml document, see _get_modeling_kind_kwarg(). I'm doing it this way because in my opinion defining the default modeling kind should be a task of the respective model constructors, not of the deserialization, since the default value is also only defined in the model part of Details of the Asset Administration Shell Part 1 (see chapter, not in the serialization/deserialization part.

The problem is, that I'm importing TypedDict from mypy_extensions, because it's only available from typing in python 3.8+. mypy is not a runtime dependency, thus I can't use mypy_extensions in code that is not for testing only.
An alternative would be to also just define the default modeling kind in the xml_deserialization, just like the json_deserialization does.

I'd like to hear your opinion on this, maybe you can come up with other alternatives.

The rest of this merge request is ready for code review btw.

Edited by Leon Mauritz Möller

Merge request reports