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

Support for unexpected keys in groups #54

Open
SebastienGllmt opened this issue Aug 18, 2022 · 0 comments
Open

Support for unexpected keys in groups #54

SebastienGllmt opened this issue Aug 18, 2022 · 0 comments
Labels
CDDL feature Feature that is required for proper parsing of CDDL files help wanted Extra attention is needed

Comments

@SebastienGllmt
Copy link
Collaborator

SebastienGllmt commented Aug 18, 2022

CIP25 for example uses CDDL to specify a set of keys that can be present, but allows people to extend the base specification with whichever key they need. This doesn't work with the current generated code as a UnknownKey error will be thrown. There should be a way to avoid this error either by

  1. changing the cddl definition (adding * any => any as a key in the map)
  2. having some way in cddl-codegen to specify not to generate an error for this specific type.

If we have to do (2), it may be that we finally have to implement some DSL that parses comment blocks to get information about how to generate the code for a specific type (which would help with #44 anyway)

Here is JS code that reproduces the error, but you could easily write a Rust test for the same thing

const metadata = wasm.Metadata.from_bytes(
  Buffer.from("a365636f6c6f72672345433937423665696d616765783a697066733a2f2f697066732f516d557662463273694846474752745a357a613156774e51387934396262746a6d59664659686745383968437132646e616d656a426572727920416c6261", "hex")
);
console.log(metadata);
@SebastienGllmt SebastienGllmt added help wanted Extra attention is needed CDDL feature Feature that is required for proper parsing of CDDL files labels Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDDL feature Feature that is required for proper parsing of CDDL files help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant