-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Allow different ways of serializing a map to cbor #48
Comments
Hi, We have requested to the foreign party to change their implementation but this is their response.
So we are kinda stuck atm. Could you take a look and let u know if you are willing to add this feature ? Thank you |
Yes, I could add the feature by decorating an object with a specific attribute (and expose the corresponding method in ObjectMapping). I could also add a general option to define the default behavior. However, I won't be able to implement it in the short term. |
That sounds like a great solution! Can you give us an approximate ETA? |
Implemented in 1.5.0 You can use either
cf. ObjectIndefiniteLengthTests.cs for concrete examples. |
Take these two serialized cbor objects: (as hex)
from your implementation:
a4686d65746144617461a16974696d657374616d7061306e7061727469636c6547726f75707381a3697061727469636c657381a4687061727469636c65a86562797465734401b5eb2d6c64657374696e6174696f6e73815102b54cee8bbc613404efca9e2e94e08d8d6466726f6d5827040a02fe22156c1fb8cc6868579b1cd0d3704ef9567a8442ee539951b2380a3f4371cc1406b8e7686d65746144617461a1636b65796576616c7565656e6f6e6365006a73657269616c697a65727772616469782e7061727469636c65732e6d65737361676562746f5827040a02fe22156c1fb8cc6868579b1cd0d3704ef9567a8442ee539951b2380a3f4371cc1406b8e76776657273696f6e18646a73657269616c697a65727372616469782e7370756e5f7061727469636c65647370696e016776657273696f6e18646a73657269616c697a65727472616469782e7061727469636c655f67726f75706776657273696f6e18646a73657269616c697a65726a72616469782e61746f6d6776657273696f6e1864
from the implementation we need to match:
bf686d65746144617461bf6974696d657374616d706130ff6e7061727469636c6547726f75707381bf697061727469636c657381bf687061727469636c65bf6562797465734401b5eb2d6c64657374696e6174696f6e73815102b54cee8bbc613404efca9e2e94e08d8d6466726f6d5827040a02fe22156c1fb8cc6868579b1cd0d3704ef9567a8442ee539951b2380a3f4371cc1406b8e7686d65746144617461bf636b65796576616c7565ff656e6f6e6365006a73657269616c697a65727772616469782e7061727469636c65732e6d65737361676562746f5827040a02fe22156c1fb8cc6868579b1cd0d3704ef9567a8442ee539951b2380a3f4371cc1406b8e76776657273696f6e1864ff6a73657269616c697a65727372616469782e7370756e5f7061727469636c65647370696e016776657273696f6e1864ff6a73657269616c697a65727472616469782e7061727469636c655f67726f75706776657273696f6e1864ff6a73657269616c697a65726a72616469782e61746f6d6776657273696f6e1864ff
as you can see (or better, verify with cbor.me) those result in the exact same object, but the hex above does not match. This is because you use map(4), and the foreign implementation uses map() and primitive() for arrays.
Your implementation is better as it requires fewer bytes for the same amount of data, but as I said I need to match the other implementations.
Can you allow customizing in which way it should be serialized?
The text was updated successfully, but these errors were encountered: