Skip to content

Added KnownTypes/Primitives

Compare
Choose a tag to compare
@grofit grofit released this 23 Mar 12:43
· 85 commits to master since this release

This release adds the notion of KnownTypes as well as KnownPrimitives to the TypeMapper as well as the Serializers, as well as a few other changes.

Known Types / Primitives

So there is now an ITypeHandler interface which allows you to implement your own serialization logic for custom types, this should ideally work in tandem with the TypeMapper which can flag types as a primitive, so for example if you were using uniRx and you had a ReactiveProperty by default it would treat it as a nested object and try to find any properties within that are flagged with [PersistData] which it would not find any. So this allows you to tell the mapping process that any ReactiveProperty types should be seen as primitives and not nested objects, then in the serialization phase tell it that you really only want to serialize the Value field, so this way you can work with 3rd party models and complex objects and serialize them in a custom way if you want to optimise your serialization or handle unsupported use-cases from out the box.

Refactors

There have also been some refactors in this release such as moving the Exceptions to their own namespace, adding an ITypeMapper interface and other type mapper implementations to the mix. There are also updates to the docs to reflect these changes.