Skip to content

Add support for numeric json class discriminators #2142

@JesseCorbett

Description

@JesseCorbett

What is your use-case and why do you need this feature?

Many APIs such as Discord use type codes, which align very closely to this library's JsonClassDiscriminator feature. However, these type codes are frequently numeric instead of strings, which makes them incompatible with this library without complex workarounds.

Describe the solution you'd like

I would prefer a solution which adds an option to specify the serialized type of a discriminator, such as an addition annotation parameter as an enum of supported types, defaulting to string

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