Correction of JsonPrinter output for metadatablock api calls
What this PR does / why we need it: This fixes the issue that some metadata properties are ommitted or duplicated in the JsonPrinter output if someone is calling the api/metadablock endpoint.
Which issue(s) this PR closes:
Closes #
Special notes for your reviewer:
Suggestions on how to test this: All tests are passed.
Does this PR introduce a user interface change? If mockups are available, please link/include them here: No user interface changes it only affects the api json output.
Is there a release notes update needed for this change?:
Additional documentation: The fix filters the metadata properties out of a list which are chield fields. Only parent properties are in the list which are then cast to an ordered set. The order logic is not changed. The addition of child properties is not changed because it is called correctly in another json() method in the JsonPrinter class.
See also discussion at https://dataverse.zulipchat.com/#narrow/stream/378866-troubleshooting/topic/metadatablocks.20api/near/457293229
@GPortas I requested a review from you because you last worked on this code in PR #10642 to fix #10637.
I have to admit I haven't looked deeply into this!
@pdurbin @GPortas The branch was updated. The integration test is now passing.
@stevenwinship I am not quite sure if there is an open task for me regarding this pull request. Is there still something to do from my side?
@ffritze Please make the above change and get the tests to pass
@ffritze I made a PR for you:
- https://github.com/TIK-NFL/dataverse/pull/24
Please take a look.
coverage: 22.571%. remained the same when pulling 957adab17f2b1b11ba8eab02a12e54931c034a09 on TIK-NFL:master_json_fix into e3b5795094bfecc4f8fc1477086f9625f5597d32 on IQSS:develop.
@pdurbin Thanks for the pull request. I merged into my branch and now the "continuous integration" test is failing. Does that matter?
@ffritze yes, it matters. 😄
Here are the latest test failures:
https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10764/5/testReport/edu.harvard.iq.dataverse.api/DataversesIT/testListMetadataBlocks/ is showing this:
1 expectation failed.
JSON path data[0].fields.size() doesn't match.
Expected: is <28>
Actual: <10>
https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10764/5/testReport/edu.harvard.iq.dataverse.api/MetadataBlocksIT/testListMetadataBlocks/ is showing this:
1 expectation failed.
JSON path data[0].fields.size() doesn't match.
Expected: <80>
Actual: <35>
@GPortas gave some advice on running DataversesIT here: https://github.com/IQSS/dataverse/pull/10764#discussion_r1731182367 . Can you please give that a try? And if it works, try running the MetadataBlocksIT tests. If you need help running these tests, please feel free to start a thread in #dev over at https://dataverse.zulipchat.com . Thanks!
@pdurbin I have fixed both of the two tests. When I run it locally, all tests are passing. Could you please provide me with another error log regarding the jenkins fail. Thanks in advance.
@ffritze thanks for adding those tests!
https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10764/8/consoleFull failed due to an unrelated S3 bucket error:
- https://github.com/gdcc/dataverse-ansible/issues/387
I just kicked off another run: https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10764/9/
Tests are passing - merging PR