Skip to content

union_serializer.py

ofrak.service.serialization.serializers.union_serializer

UnionSerializer (SerializerInterface)

Serialize and deserialize Union[...] into PJSONType.

This includes Optional, as Optional[X] == Union[X, type(None)]

Implementation: all types in the Union are tried in order, and the first for which handling doesn't return an error is used.