Conversation
Clarify the comments describing cbor.Tag and cbor.RawTag.
Mention that: - time encoding options provided by cbor.TimeMode comply with RFC 8949. - user apps that prefer to encode time in other ways (e.g. not specified by RFC 8949) can use a CBOR tag number not assigned by IANA and implement cbor.Marshal and cbor.Unmarshal interfaces. Also, update the comments for each time encoding option to be more useful to programmers who did not read RFC 8949. The old comments were meant to be stop-gaps due to schedule.
9ed18b9 to
df7db22
Compare
36287cc to
1c154a2
Compare
fxamacker
commented
Apr 27, 2025
Owner
Author
fxamacker
left a comment
There was a problem hiding this comment.
Thanks for reviewing!
BTW, I changed "content" to "value" in my last commit (no other changes):
preserves the 64-bit floating point
contentvalue.
Before merging this, I want to update my comments in the Embedded JSON example today (April 27) but I need to be AFK for a while.
1c154a2 to
92f7b97
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #657 #656
This PR updates some comments and adds a requested example. The example shows how to user apps can use almost any current or future CBOR tag number by implementing
cbor.Marshalerandcbor.Unmarshalerinterfaces.Essentially,
MarshalCBORandUnmarshalCBORimplemented by user apps are automatically called by this CBOR codec'sMarshal,Unmarshal, etc.The example encodes and decodes a tagged CBOR data item with tag number 262 and the tag content is a JSON object that is "embedded" as a CBOR byte string (major type 2).
Note
RFC 8949 does not mention CBOR tag number 262. IANA assigned CBOR tag number 262 to "Embedded JSON Object" and references the document Embedded JSON Tag for CBOR.
Changes:
cbor.TimeModeoptions.cbor.Tagandcbor.RawTag.Thanks for your patience. 🙏