You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re encoding .. yeah that's an interesting case and you're right that we probably should be not allowing encoding of invalid forms!
I'm not in favour of silently dropping fields, however. I think in this case it should error on encode rather than apparently succeeding but losing some of your data. The "this is not right" signal should bubble up from the encoder to be dealt with by a different layer accordingly. If you want a layer to massage invalid data into an encodable form then that's fine but I don't think it belongs directly in the encode() of the codec - something like dag-pb's prepare() might be OK for that. Similar to the discussion in ipld/js-dag-cbor#57.
Here is an example code to reproduce the problem:
I would expect encoder to just ignore
message
field of thehello
and encode it as link as opposed to encoding it into an invalid block.The text was updated successfully, but these errors were encountered: