Feature request: Add and support int key for CborPropertyAttribute
Closed this issue · 2 comments
rmja commented
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.
mcatanzariti commented
plan:
- add a property
int Index
toCborPropertyAttribute
- add a
CborObjectFormatAttribute
to annotate a class or a struct
mcatanzariti commented
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.