-
Notifications
You must be signed in to change notification settings - Fork 25
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
cbor: decode undefined as null #54
Conversation
See: ipfs/kubo#5776 This won't round-trip undef, it'll just convert it to null (which is what most decoders do anyways).
Sounds good to me. Encoding is kind of related. We should make sure that we normally don't ever end up with having |
We'll get a "zero" (empty) value. |
I didn't realize cbor had an I'm fine with de-serializing |
Interesting. I don't think we should drop them in decoders, but I do think the JS encoder should throw when it has a "failed to encode" state. |
Got it. Should we just say that this is implementation defined behavior? That is, implementations may choose to decode |
Yeah, I think for the specification of how dag-cbor relates to IPLD, calling this implementation defined is reasonable. Although (and maybe this is obvious, but for clarity's sake) that also needs to come with a caveat that cbor which contains these 'undefined' values is not canonical. |
This sounds right. Languages diff enough that it's appropriate to allow each one to determine how to interpret and serialize to cbor's |
See: ipfs/kubo#5776
This won't round-trip undef, it'll just convert it to null (which is what most decoders do anyways).
also fixes #53