Skip to content

Discriminated Sum/Union/Choice types #48

@beached

Description

@beached

Im not sure if this is in focus yet, but when attempting to fail at using JSON Schema as an IDL, one of the biggest issues was explicitly mapping a sum type to it's discriminator. Yes there is a must exist relationship, but it didn't help with things like the "type" member having a value of X and that means the "value" member must be a Foo. This was in regard to using C++, which has language/library support for this via the variant type.

The tags can be in many places in many JSON document in the wild though. Commonly it is a submember of the current value/type, it is a member at the same level, or the existence of a member/key(using them synonymously) at those levels too. But other forms exist too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions