-
Notifications
You must be signed in to change notification settings - Fork 17
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
can we add option to strip undefined instead of erroring #57
Comments
The problem with being flexible with But, that's obviously not as clean when we hit the real world, and we have a couple of instances of sloppy behaviour:
So there's two approaches we could take to alleviate the pain:
How important is this? Is this simply a quality of life feature, or is it getting in the way and being a problem for downstream users? I could do some work on the CBOR encoder to expose options to do this but I don't know how to prioritise this and I have other things on my plate vying for attention. |
It is pretty problematic at least in the context of UCAN based RPC system because service implementation:
At the moment I'm working around this by going over the returned values and:
This is pretty unfortunate, because same data structure gets traversed once before handing it off to CBOR encoder which then traverses it again to actually encode. |
In terms of ideal solution it would something along the lines of:
|
One could argue that leaving out While I generally prefer early errors, I'm still finding that This You could probably start rejecting any class instances too, but I'm not sure if that would be an improvement. |
+1 to a "cbor.prepare" or similar, or maybe a flag to do the sanitization. |
I've been working on UCAN based RPC system that encodes request / responses into set of CBOR blocks in a CAR. Unfortunately it proved challenging to not encounter errors from CBOR codec due to some field set to
undefined
or due to some built-in data type like Error been referenced.Could we add an option to make CBOR codec behave more or less like JSON.stringify does, specifically
undefined
valuesThe text was updated successfully, but these errors were encountered: