-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
CBORParser
does not accept "undefined value"
#93
Comments
@mbaril Could you point to a document or article that explains semantics of the type? I assume this is one of (optional) extension types? I can't really comment on how such type should behave before reading about its semantics within CBOR, but there are ways to expose values for which there is no JSON counterpart; typically as |
Ok thanks. I assume this to be a relatively new addition, since I did not remember such a value.... I am guessing this might try to somehow capture logical case of "not defined vs explicit Anyway: the simplest way would seem to be to just expose this as |
Further from the spec:
which suggest two likely courses of action:
I think the simplest initial approach would be (1) here, and at very least I think that would make sense for 2.8 (minimal change for patch of a maintenance branch). For 2.9 other changes are still possible, although we are getting very close to 2.9 API freeze. |
IMHO it is important to be able to make the difference between "null" (Major Type: 7, Additional info: 22) and "undefined value" (Major Type: 7, Additional info: 23) because the meaning is not exactly the same (as you pointed out (section 3.8). If I understand your propositions correctly, I don't think it will be possible to make such distinction with option #1. For that reason, my preference would be to go with option #2. Right now, when we call the CBOR parser with an undefined value the next token function throws an JsonParseException. For that reason, I think that option #2 is also the option that is the most appropriate if you want to keep the same behaviour as before. |
Do you have specific reason to differentiate explicit As to distinguishing the "undefined" value; for most data-binding use cases (taking CBOR, getting POJOs) it seems The other option, exposing Still, exposing as |
Hi, is this issue still on the table? I would prefer a In the meantime I will fork to make the change myself as I need to be able to parse undefined values. I can submit a PR if that is something you'd be interested in pulling in. |
@bgiori Yes, no progress. I think my take on this is as follows:
So; PR against 2.9 branch for just returning |
Hmmh. After re-reading the specification, I am beginning to think that encoding use of Sigh. I like CBOR specification in many places, but just is just Weird, and not in a good way. |
CBORParser
does not accept "undefined value"
CBORParser
does not accept "undefined value"CBORParser
does not accept "undefined value"
Implemented so that "undefined" is now return as Created #137 as follow-up item for improvements in 2.10. |
I'm trying to use the CBORParser to parse a byte stream but the method nextToken() throws JsonParseException when the stream contains "undefined value" (Major Type: 7, Additional info: 23).
I guess it is because there in no equivalent for this datatype in JSON.
Is it possible to use the CBORParser when input stream contain "undefined value"?
Would that be a good idea to modify the CBORParser class to add a new method "nextCborToken" to add support for "undefined value"?
The text was updated successfully, but these errors were encountered: