Skip to content
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

Wishlist: support for CBOR Sequences #145

Open
extemporalgenome opened this issue Jun 10, 2024 · 1 comment
Open

Wishlist: support for CBOR Sequences #145

extemporalgenome opened this issue Jun 10, 2024 · 1 comment

Comments

@extemporalgenome
Copy link

https://www.rfc-editor.org/rfc/rfc8742.html

For example, if support for cbor sequences were present, I believe the following should parse:

{
  echo '{"a":1}' | cbor-diag --to=bytes ;
  echo '{"b":2}' | cbor-diag --to=bytes ;
} | cbor-diag --to=annotated

Ideally the following would work as well (accept jsonl/ndjson and other representations of sequences of documents):

{ echo '{"a":1}' ; echo '{"b":2}' ; } | cbor-diag --to=annotated
@Nemo157
Copy link
Member

Nemo157 commented Jun 10, 2024

> {
  echo '{"a":1}' | cbor-diag --to=bytes ;
  echo '{"b":2}' | cbor-diag --to=bytes ;
} | cbor-diag --seq --to=annotated
a1       # map(1)
   61    #   text(1)
      61 #     "a"
   01    #   unsigned(1)

a1       # map(1)
   61    #   text(1)
      62 #     "b"
   02    #   unsigned(2)

--seq currently implies --from=bytes, but it seems reasonable to support other formats with it too (would need to add more _partial functions to the library for them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants