dataverse icon indicating copy to clipboard operation
dataverse copied to clipboard

Correction of JsonPrinter output for metadatablock api calls

Open ffritze opened this issue 1 year ago • 2 comments

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.

ffritze avatar Aug 09 '24 08:08 ffritze

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 avatar Aug 12 '24 14:08 pdurbin

@pdurbin @GPortas The branch was updated. The integration test is now passing.

ffritze avatar Aug 29 '24 06:08 ffritze

@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 avatar Nov 20 '24 11:11 ffritze

@ffritze Please make the above change and get the tests to pass

stevenwinship avatar Dec 16 '24 13:12 stevenwinship

@ffritze I made a PR for you:

  • https://github.com/TIK-NFL/dataverse/pull/24

Please take a look.

pdurbin avatar Dec 16 '24 14:12 pdurbin

Coverage Status

coverage: 22.571%. remained the same when pulling 957adab17f2b1b11ba8eab02a12e54931c034a09 on TIK-NFL:master_json_fix into e3b5795094bfecc4f8fc1477086f9625f5597d32 on IQSS:develop.

coveralls avatar Dec 17 '24 12:12 coveralls

@pdurbin Thanks for the pull request. I merged into my branch and now the "continuous integration" test is failing. Does that matter?

ffritze avatar Dec 17 '24 13:12 ffritze

@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 avatar Dec 17 '24 14:12 pdurbin

@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 avatar Dec 18 '24 09:12 ffritze

@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/

pdurbin avatar Dec 18 '24 15:12 pdurbin

Tests are passing - merging PR

ofahimIQSS avatar Dec 20 '24 15:12 ofahimIQSS