octue/twined

Direction of serialisation (and kwarg `cls` overloaded incorrectly) should be resolved in validators

Opened this issue · 0 comments

In the twine validation methods e.g. here the cls keyword is overloaded, in order to determine the serialisation direction and correctly cast inbound classes to objects.

However, this may not be the best design, as a cls keyword argument is also accepted by the lower level json decoders in load_json and essentially gets popped from the kwargs. here.

Perhaps it's as simple as renaming this cls argument e.g. to klass, but more likely we want to provide a decoder rather than a map.

Trick is: This decoder needs to be called where load_json receives a source object too.