Skip to content
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

Consider replacing serde traits on all data types #61

Open
justAnIdentity opened this issue Oct 31, 2023 · 2 comments
Open

Consider replacing serde traits on all data types #61

justAnIdentity opened this issue Oct 31, 2023 · 2 comments

Comments

@justAnIdentity
Copy link
Contributor

Currently all definitions for the data types in isomdl / cose derive the Serialize and Deserialize traits from serde. This is for convenience since this gives us an easy way to convert to and from cbor.

The problem with this however is it also enables these structs to be converted to/from any representation that has a serde implementation, and many of these structs have cbor specific structure which would be lost when roundtripped through a non-cbor representation.

Another problem is that the serde traits lead to fallible conversion to cbor, which makes for more complicated logic in the code. We know that by definition are structs are always representable in cbor, so we could define trait(s) that allow us to always convert to cbor without erroring.

These are potentially small issues, so we should analyze whether moving away form serde to custom trait(s) is worthwhile.

@justAnIdentity
Copy link
Contributor Author

cc @sbihel something to ponder

@sbihel
Copy link
Member

sbihel commented Nov 1, 2023

I don't think the fact that it could be misused and serialised to other encodings is something to be concerned about. Many libraries/applications are JSON specific but still use serde.

But yes, if I remember correctly we already decided that serde just doesn't play well with CBOR, and we've already moved away from it in other libraries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants