aas-core-works / aas-core3.0-python

Manipulate, verify and de/serialize asset administration shells in Python.
Other
4 stars 0 forks source link

JSON deserialization: Empty objects accepted where arrays are expected #31

Closed otto-ifak closed 1 week ago

otto-ifak commented 2 weeks ago

In JSON deserialization, the SDK accepts empty objects where an array is expected. Eg. keys in the following:

{
   "modelType": "Property",
   "valueId": {
        "type": "ModelReference",
         "keys": {}
      }
}

I guess this is caused by code like the following:

        if not isinstance(jsonable, collections.abc.Iterable):
            raise DeserializationException(
                f"Expected an iterable, but got: {type(jsonable)}"
            )

(Dict implements Iterable)

mristin commented 2 weeks ago

Thanks! Wĥat a footgun, Python!

otto-ifak commented 2 weeks ago

:laughing: yes