Dahomey.Cbor
Dahomey.Cbor copied to clipboard
Feature request: Add and support int key for CborPropertyAttribute
It would be really useful if the CborPropertyAttribute could support an int key similar to the KeyAttribute in MessagePack.
Edit: Mayby this is actually two feature requests:
- CborProperty(x) should be used in an map object mapping where the key is the integer x.
- CborKey(x) should be used in an array mapping where x is the array position just like messagepack.
plan:
- add a property
int IndextoCborPropertyAttribute - add a
CborObjectFormatAttributeto annotate a class or a struct
Current implementation does not yet support Discriminators nor CreatorMappings.
Supporting Discriminators is tricky, especially for the array format because the number of items in the array for a specific class could be variable if DiscriminatorPolicy is set to Auto.
One possible implementation is to use a Semantic Tag to identify the discriminator property/field. Semating Tag 39 could be used for this purpose.