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

Choice parsing leads to missing data errors #308

Closed
aj-stein-nist opened this issue Feb 7, 2024 · 1 comment · Fixed by #316
Closed

Choice parsing leads to missing data errors #308

aj-stein-nist opened this issue Feb 7, 2024 · 1 comment · Fixed by #316
Assignees
Labels
bug Something isn't working java Pull requests that update Java code
Milestone

Comments

@aj-stein-nist
Copy link
Collaborator

aj-stein-nist commented Feb 7, 2024

Describe the bug

As reporting while debugging examples for usnistgov/metaschema#530, Dave and I determined that some model elements are being dropped when analyzing and validating document instances for fields, flags, and assembly node items bound to <choice/>s. I will be updating this ticket with example feature branch and tests with modules and instances that exhibit this error.

Who is the bug affecting?

Metaschema model developers and maintainers using the CLI or library.

What is affected by this bug?

Properly serilaizing and deserializing node items bound to fields/flags/assemblies in choices.

When does this occur?

Consistently.

How do we replicate the issue?

  1. Run tests from the bug report branch.

If applicable, add screenshots to help explain your problem.}

Expected behavior (i.e. solution)

The library and/or CLI deserializes choice-based fields, flags, and correctly.

Other Comments

N/A

@aj-stein-nist aj-stein-nist added bug Something isn't working java Pull requests that update Java code labels Feb 7, 2024
aj-stein-nist added a commit to aj-stein-nist/metaschema-java that referenced this issue Feb 7, 2024
@aj-stein-nist
Copy link
Collaborator Author

Also per discussion with @david-waltermire, we ought to fix the space in the warning about skipping unhandled data in the fix for this bug, like Skipping unhandled JSON field 'y'FIELD_NAME 'y' at location '3:15'. from the model in the bug report below.

$ metaschema-cli validate-content -m metaschema.xml example.json --show-stack-trace
Loading module 'file:///home/me/code/issue-308_metaschema.xml'
Generating Java classes in: /tmp/validation-18284471153627273139
Validating '/home/me/code/issue-308_instance.json' as JSON.
Skipping unhandled JSON field 'y'FIELD_NAME 'y' at location '3:15'.
Validation identified the following in file '/home/me/code/issue-308_instance.json'.
The file '/home/me/code/issue-308_instance.json' is valid.

aj-stein-nist added a commit to aj-stein-nist/metaschema-java that referenced this issue Feb 8, 2024
david-waltermire added a commit to david-waltermire/metaschema-java-old that referenced this issue Feb 9, 2024
@aj-stein-nist aj-stein-nist linked a pull request Feb 9, 2024 that will close this issue
7 tasks
aj-stein-nist pushed a commit to aj-stein-nist/metaschema-java that referenced this issue Feb 9, 2024
aj-stein-nist pushed a commit to aj-stein-nist/metaschema-java that referenced this issue Feb 9, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 9, 2024
* Fixed XML choice model parsing to ensure instances are also added to the model instance list.

* Improved some error messages to have correct formatting and to provide more context in messages.

* Fixed a few spotbugs errors and Java compiler warnings.

* Added JSON parser test to test for the #308 regression.

---------

Co-authored-by: David Waltermire <[email protected]>
@david-waltermire david-waltermire added this to the v1.0.0-M2 milestone Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working java Pull requests that update Java code
Projects
None yet
2 participants