Skip to content

How can one use a custom serializer in a BackwardsCompatible serializer? #19

Description

@pmbanka

BackwardsCompatible serializer uses Comapct and Default serializer. Is there a way to use some other (custom) serializer in there, like CamelCaseSerializer in place of Compact?

Maybe current approach to serializers (modules + SRTP) allows for it, but it is simply too hard for me to reason about.

I think creating a composable serializer would be easy if some common interface for the serializers were introduced (in place of SRTP).

type ISerializer =
    abstract member serialize<'T> : 'T->string
    // etc.

type FallbackSerializer(main : ISerializer, fallback : ISerializer) =
    implement ISerializer with
    // etc

What would be the downsides of such approach?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions