CBOR ⇔ YAML mappings #8
Replies: 3 comments 1 reply
-
Relationship to CBOR Diagnostic Notationhttps://www.rfc-editor.org/rfc/rfc8949.html#name-diagnostic-notation discusses a text based format for CBOR to facilitate documentation and discussion. It borrows from JSON syntax but extends JSON in several ways that are not at all YAMLish. NOTE: The diagnostic format was not meant to be parsed. A standardized, bidirectional mapping between YAML and CBOR might be valuable as a alternate diagnostic notation. I will try to give examples in future posts. I note that there is also an Extended Diagnostic Notation described in Appendix G of RFC8610. Frankly, I'm still trying to understand CDDL to my satisfaction, so I will not comment further. |
Beta Was this translation helpful? Give feedback.
-
Tim Berners-Lee regretted one small thingAccording to the New York Times, the web's inventor, when asked "Any regrets?" had one:
The times however failed to mention the W3Cs mitigation to Tim's concern, CURIE Syntax 1.0. CURIES (Compact URIs) are an extension of the QNAME concept, which was found to be overly restrictive. Unfortunately, all that happened after YAML's creation. There exists however so much flexibility in YAML's conservative definition that might allow the use of CURIEs in YAML... |
Beta Was this translation helpful? Give feedback.
-
On 2023-06-10, at 18:20, Burt Harris ***@***.***> wrote:
= Relationship to CBOR Diagnostic Notation
https://www.rfc-editor.org/rfc/rfc8949.html#name-diagnostic-notation discusses a text based format for CBOR to facilitate documentation and discussion. This format **was not meant to be parsed **. It borrows from JSON syntax but extends JSON in several ways that are not at all YAMLish.
Indeed. A binary format needs to come with a text-based representation that everyone will recognize and understand, for use on whiteboards as well as on . Therefore we standardized such a notation right away with CBOR.
At the time (2013 in RFC 7049), it seemed easier to attain consensus to start with JSON and add a few extensions. We then added a few convenience features (“extended diagnostic notation”, EDN) in 2019 (RFC 8610). A few more are in the pipeline [1].
We found it useful to mechanically check examples in RFCs that employ diagnostic notation, so there are now parsers for it [2]. (E)DN is still not something that we would use for the actual interchange of data.
A standardized, bidirectional mapping between YAML and CBOR might be valuable as a better diagnostic notation. I will try to give examples in future posts.
In my personal editor configuration, CBOR files are opened by converting them to YAML [3] (and converting back to CBOR on writing). This works great for me (and YAML is my go-to format for a human-processable form of JSON). YAML may however not be for everyone [4].
My biggest practical problem is that binary data are by default base64-encoded in YAML; that can be very jarring (or great — the CBOR data simply doesn’t have any indication which would be the best textual representation).
Until now an obstacle for using YAML as a textual notation for CBOR was that there was no IETF document we could point to; this of course is being fixed now (although the media-type registration does not give me an actual definition of YAML).
I think we will continue to use CBOR (extended) diagnostic notation for examples in RFCs.
Grüße, Carsten
[1]: https://www.ietf.org/archive/id/draft-bormann-cbor-edn-literals-02.html
[2]: https://github.com/cabo/cbor-diag
[3]: cbor2yaml.rb/yaml2cbor.br in [2]
[4]: https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
|
Beta Was this translation helpful? Give feedback.
-
Credits where credit due:
Thanks guys.
I propose we discuss ideas regarding YAML tags to produce a formal mapping with Compact Binary Object Representation, (CBOR RFC 8949) and related RFCs, for example:
TLDR
Continues Issue #7
CBOR (Concise Binary Object Representation) originally published as RFC 7049 in 2013 by Carsten Bormann (@cabo). I asked Carsten about this some time ago, and he clearly was knowledgeable about YAML.
CBOR is a binary format that is designed to be compact and efficient. CBOR implementations tend to be very fast and have a developer-friendly API .
On the other hand, YAML is a human-readable serialization format that is designed to be easy to read and write. [It is often used for configuration files and data exchange between different programming languages (https://discourse.mc-stan.org/t/notes-on-stan-output-serialization-options-yaml-protobuf-avro-cbor/12837)[1] YAML supports complex data structures such as lists, maps, and nested structures .
Importantly CBOR and YAML are both extensible through the use of tags that express extensible data types! While there are some semantic differences between tags in these two standards, I think they can be identified and mitigated due to the inherent flexibility of YAML; it might take some outside-the-box thinking.
Given the amazing versatility of @eemei/yaml, I think this would be the perfect place to take advantage of the common heritage between these, which traces back to JavaScript and JSON. Also, I note that while this common heritage linking back to JavaScript was based on an now long-past standard for the language, which has since been substantially improved. In the path from then to now, some terminology differences have crept into both YAML and CBOR/CDDL which complicate such discussions.
Beta Was this translation helpful? Give feedback.
All reactions