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

Add support for CDDL #325

Open
lrosenthol opened this issue Jun 16, 2021 · 4 comments
Open

Add support for CDDL #325

lrosenthol opened this issue Jun 16, 2021 · 4 comments

Comments

@lrosenthol
Copy link

Describe the proposed feature

CDDL is the notational convention for describing CBOR data structures (https://datatracker.ietf.org/doc/html/rfc8610) - think JSON Schema for CBOR - though it is also useful for JSON as well.

What other libraries (C++ or other) have this feature?

None :(. This page (cbor-wg/cddl#29) tracks implementations and there seem to be none in C/C++. So you could be the first!

@danielaparker
Copy link
Owner

It's on the list. It may take a while, though.

@lrosenthol
Copy link
Author

You might find this interesting/useful - it's Python that produces C code based on a CDDL description - https://github.com/NordicSemiconductor/cddl-gen

@danielaparker
Copy link
Owner

danielaparker commented Jul 1, 2021

I think before looking at CDDL I need to revisit some aspects of the CBOR implementation. Currently it transforms CBOR events into jsoncons events during parsing, feeding those events into a json_visitor. I think I need another layer so we have a cbor_visitor that is first to receive raw CBOR events, and which users can intercept if they wish. I think I also need a big_decimal class for subsequent mapping of CBOR big decimal numbers. Other languages have this easier, standard C++ lacks so many types, no big integer, no big decimal, no portable int128, no portable float128. I'll probably get to CBOR Diagnostic Notation before CDDL.

@lrosenthol
Copy link
Author

I think I need another layer so we have a cbor_visitor that is first to receive raw CBOR events, and which users can intercept if they wish.

That would indeed be helpful for a number of cases.

I think I also need a big_decimal class for subsequent mapping of CBOR big decimal numbers.

Yes and others, as you note. It's also important to make sure that the original CBOR type is available to this new cbor_visitor to improve handling of custom tags or simply adding support for other types not natively supported in jsoncons.

I'll probably get to CBOR Diagnostic Notation before CDDL.

That works for me!

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

No branches or pull requests

2 participants