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

Fix jer optional values #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

davxy
Copy link

@davxy davxy commented Jun 26, 2024

This fails otherwise

schema.asn

TestModule DEFINITIONS ::= BEGIN

U8 ::= INTEGER (0..255)
U32 ::= INTEGER (0..4294967295)

Testcase ::= SEQUENCE {
    epoch-mark [0] U32 OPTIONAL,
    tickets-mark [1] U8 OPTIONAL
}

END

data.json

{
    "epoch-mark": null,
    "tickets-mark": null
}

validate.py

schema = asn1tools.compile_files("schema.asn", codec="jer")
json_bytes = open("data.json", "rb").read()
dec = schema.decode("Testcase", json_bytes)
enc = schema.encode("Testcase", dec)

⚠️ I'm not familiar with the codebase, and my solution is primarily an "it works for me" approach ⚠️

  • solves the failing test case I've pasted above
  • don't know if there is a better one
  • don't know if it breaks something else :-)

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

Successfully merging this pull request may close these issues.

None yet

1 participant