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

any and cbor-any are ignored when generating code #432

Open
aangert opened this issue May 15, 2024 · 1 comment
Open

any and cbor-any are ignored when generating code #432

aangert opened this issue May 15, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@aangert
Copy link

aangert commented May 15, 2024

When generating code with zcbor code -c pet.cddl -d -e -t Pet --output-cmake ~/generated/pet any element of type any or cbor-any is ignored and missing in the generated struct. zcbor doesn't generate a warning about this

pet.cddl:

Pet = [
    name: [ +tstr ],
    missing: any,
    also_missing: cbor-any,
]

pet_types.h:

struct Pet {
	struct zcbor_string Pet_name_tstr[10];
	size_t Pet_name_tstr_count;
};
@oyvindronningstad
Copy link
Collaborator

oyvindronningstad commented Jun 14, 2024

That's the current way "any" works. Representing a decoded "any" object in code is complex so this hasn't been done yet. There's some work looking into this, so I will update here when that is merged.

In a pinch you can use a union with all the possible types.

@oyvindronningstad oyvindronningstad added the enhancement New feature or request label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants