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

List of tstr does not get label defined in CDDL #468

Open
leeky-mem opened this issue Nov 20, 2024 · 2 comments
Open

List of tstr does not get label defined in CDDL #468

leeky-mem opened this issue Nov 20, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@leeky-mem
Copy link

The name of a struct member of type list of tstr is not the label specified in the CDDL code. See example below:

CDDL:

TEST_MAP_T = {
    test_entry:1 => [+tstr]
}

Expected generated code:

struct TEST_MAP_T {

    struct zcbor_string test_entry[10];

    size_t test_entry_count;

};

Actual generated code:

struct TEST_MAP_T {

    struct zcbor_string tstr[10];

    size_t tstr_count;
};

When defining map entries that aren't lists, the defined label are used as member names in the struct, but not with lists.
This makes the intention of the struct member hard to understand. One must always go back to the CDDL code to view the label.

@leeky-mem leeky-mem changed the title List of tstr does not label defined in CDDL List of tstr does get not label defined in CDDL Nov 20, 2024
@oyvindronningstad oyvindronningstad added the enhancement New feature or request label Nov 21, 2024
@oyvindronningstad
Copy link
Collaborator

Thanks. Member naming is something I improve from time to time. I will keep this in mind the next time, though there is nothing planned for now.

Assuming you are using --short-names, you can try to generate without that to see if it turns out better.

@leeky-mem
Copy link
Author

Ok, thanks for the hint. I will try without --short-names

@leeky-mem leeky-mem changed the title List of tstr does get not label defined in CDDL List of tstr does not get label defined in CDDL Nov 29, 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