Open mcatanzariti opened 1 year ago
Interesting! I'll look at this in more detail, but doing something like this certainly was in the cards. We'll have a JSONPath interim meeting on Tuesday and a CBOR interim meeting on Wednesday; I'll make sure that this work gets some mention there (even if there isn't an Internet-Draft[^1] to discuss yet).
[^1]: This is what we like to call our draft RFCs, because they aren't RFCs yet...
Based on the JSONPath Internet Draft, I recently wrote a
CBORPath
implementation in Rust: https://github.com/dahomey-technologies/cborpath-rs.The main difference between
JSONPath
and myCBORPath
proposal is that CBORPath is itself represented as a valid CBOR expression.Pros:
CBOR
value, including a byte string can be expressed in aCBORPath
expression.CBOR
map key can be any validCBOR
value, not only text likeJSON
object names. Consequently, theJSONPath
name-selector is replaced by aCBORPath
key-selector.CBOR
parser or deserializer is enough to validate aCBORPath
expression, no need to write neither a grammar nor a parser.Cons:
CBORPath
expression is more verbose than theJSONPath
equivalentThank you to give your thoughts about the proposal. I may take the time to write an Internet draft.
Michaël
PS: reddit post link