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

How does decoding unordered maps work? #411

Open
mkschreder opened this issue Feb 29, 2024 · 2 comments · May be fixed by #425
Open

How does decoding unordered maps work? #411

mkschreder opened this issue Feb 29, 2024 · 2 comments · May be fixed by #425
Labels
enhancement New feature or request

Comments

@mkschreder
Copy link

It seems that current code generator is still outputting code that expects map keys in the exact order that they are defined in cddl.

Type = {
   key_a: int,
   key_b: int
}

The code generated from this will be a long if statement where the fields are in exact order with && between. So decoding in any order does not work.

Is there a workaround for this?

@oyvindronningstad
Copy link
Collaborator

No, the code generator does not yet use the unordered maps API, but this is planned to be implemented soon-ish.

@mkschreder
Copy link
Author

I think it's really important because the following passage of the specification does not hold true for the current decoder:

image

In the current implementation the map behaves like a list where all fields must come in exact order.

@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

Successfully merging a pull request may close this issue.

2 participants