-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor input JSON support #83
Conversation
@rgdeen in the future, when trying to attach files that GitHub doesn't like, we tend to just group them together and create a zip |
@jordanpadams here ya go... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments are not really using the appropriate coding standard to be picked up by apidocs. Also, no tests provided so really no way to ensure this code is successful, but considering I am fairly certain this code is strictly used by labelocity, I am going to merge this once we get some test data.
@rgdeen can you please upload a set of example templates/data files and how to manually run in order to test that this works? src/test/resources/
works to put your test data.
@rgdeen actually, I see that you copy-pasted those files into the PR comments, but can we actually upload these to the repo? |
and add them here: https://github.com/NASA-PDS/mi-label/tree/main/src/test/resources |
Bumps commons-io:commons-io from 2.16.1 to 2.17.0. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps org.slf4j:slf4j-simple from 2.0.13 to 2.0.16. --- updated-dependencies: - dependency-name: org.slf4j:slf4j-simple dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps org.slf4j:slf4j-api from 2.0.13 to 2.0.16. --- updated-dependencies: - dependency-name: org.slf4j:slf4j-api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps commons-cli:commons-cli from 1.8.0 to 1.9.0. --- updated-dependencies: - dependency-name: commons-cli:commons-cli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
We do not have an automated framework in place, but the test data is available.
|
🗒️ Summary
Support for JSON as an input file was partial at best. It allowed for access to top-level items but did not properly support structure such as arrays and maps. Fixed this by ditching most of the JSON-specific code (it tried to shoehorn the JSON into the PDS3Label structure to mimic PDS3 labels) and instead just registering the parse tree from the JSON parser directly with the Velocity engine. Turns out this Just Works, amazingly. One issue is that values were returned with quotes around them by the parsing engine. This was fixed by implementing a Velocity Uberspector to intercept get calls to the tree and dequote the values.
⚙️ Test Data and/or Report
Unfortunately, the "generate" wrapper script does not accept JSON input - this should be changed but is outside the scope. It is callable by the Labelocity wrapper (jConvertIIO) which is what I used for testing. Therefore I don't have a specific runnable test just for this package (and there is no general regression test). However, here's how to test using Labelocity.
$R2LIB/gen dummy.vic 10 10 ## really, any vicar file, it's not used but has to be present
java jpl.mipl.io.jConvertIIO inp=dummy.vic out=test_json.xml format=pds4 pds_detached_only=true pds_label_type=PDS4 velo_template=test_json.vm extra_file_name=test_json.json extra_file_type=json
See below for files.
♻️ Related Issues
TESTING FILES (GitHub would not allow me to attach .vm or .xml files)
====
test_json.json
====
test_json.vm
====
test_json.xml (output)
Resolves #84