Skip to content

Allow types to specify the tags for their pieces during serialization #248

Open
@braxtonmckee

Description

@braxtonmckee

Our serialization library has a similar structure to protobuf - we want each field in a composite datastructure to have a field id that's stable over time as we change types so that objects serialized under old versions of the code can still be read and manipulated. Right now, we have no way of controlling this, so we're only stable if we append elements to a Tuple, NamedTuple, OneOf, or Alternative. We should have a syntax for explicitly setting these IDs.

I was thinking something like

OneOf(int, float) == OneOf({int: 0, float: 1})

for one of, and

NamedTuple(x=int, y=float) == NamedTuple(x=int, y=float).withTags(x=0, y=1)

Not sure what the best approach for alternatives and classes is yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions