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

addDataverse API endpoint extension for input levels and facet list setup #10644

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

GPortas
Copy link
Contributor

@GPortas GPortas commented Jun 21, 2024

What this PR does / why we need it:

The addDataverse (/api/dataverses/{identifier}) API endpoint has been extended to allow adding metadata blocks, input levels and facet ids at creation time, as the Dataverse page in create mode does in JSF.

Which issue(s) this PR closes:

Special notes for your reviewer:

I had to modify the CreateDataverseCommand to add the logic for adding metadata blocks, as well as other logic related to the Dataverse instance and its input levels and facets. I also had to reorder the code for persisting the dataverse collection with all the changes.

The logic I had to add to the command was previously handled in JSF from the Dataverse Page before calling the command, and without these modifications, calling the command from the API with input levels and/or facet ids resulted in an inconsistent state for the created Dataverse. The API was sending facetIds and inputLevels as null, since they were not supported in the endpoint request body, so these issues went unnoticed.

I have implemented the changes in such a way that they do not interfere with the current behavior of JSF, as the command is still consumed in the same way in JSF and I have not made any changes to the DataversePage.class. I have performed several manual tests with logging to ensure that there is no impact on the behavior of JSF, but due to the lack of test coverage in this area, I recommend an analysis of possible implications by the PR reviewer.

Suggestions on how to test this:

IT tests have been implemented, covering cases where metadata blocks, input levels, or facet IDs are set in the dataverse collection. However, I recommend performing manual tests by calling the endpoint and verifying the correct persistence of the dataverse, its metadata blocks, input levels, and facets.

Create JSON file following the new example provided in the docs: https://github.com/IQSS/dataverse/blob/e65eb9f947beec06ddbfc6f0bfb73f7ecaf60d28/doc/sphinx-guides/source/_static/api/dataverse-complete-optional-params.json

Call the endoint as described in the docs:

curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X POST "https://demo.dataverse.org/api/dataverses/root" --upload-file dataverse-complete-optional-params.json

Now you need to verify that all necessary information about the new dataverse collection, its metadata blocks, input levels, and facet IDs has been correctly persisted.

We can confirm that the information has been correctly persisted if, after entering the dataverse collection page, the input levels and facets sections have the fields set in the JSON.

Input levels:
Screenshot 2024-07-02 at 15 31 08

Facet ids:
Screenshot 2024-07-02 at 15 31 16

As an additional verification, we can check the persisted information in the related database tables.

  • dataverse_metadatablock table
  • dataversefieldtypeinputlevel table
  • dataversefacettable

Does this PR introduce a user interface change? If mockups are available, please link/include them here:
None

Is there a release notes update needed for this change?:
Yes, attached

Additional documentation:
None

@coveralls
Copy link

Coverage Status

coverage: 20.661%. remained the same
when pulling 3dd6355 on 10633-create-collection-api-ext
into 0f0c3b6 on develop.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.659% (-0.002%) from 20.661%
when pulling 1cc48b7 on 10633-create-collection-api-ext
into 0f0c3b6 on develop.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.659% (-0.002%) from 20.661%
when pulling 8c88d14 on 10633-create-collection-api-ext
into 0f0c3b6 on develop.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.654% (-0.007%) from 20.661%
when pulling 7840a02 on 10633-create-collection-api-ext
into 0f0c3b6 on develop.

This comment has been minimized.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.628% (-0.03%) from 20.661%
when pulling 1651f80 on 10633-create-collection-api-ext
into 0f0c3b6 on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.655% (-0.006%) from 20.661%
when pulling 1651f80 on 10633-create-collection-api-ext
into 0f0c3b6 on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.629% (-0.006%) from 20.635%
when pulling cb4d1ac on 10633-create-collection-api-ext
into 43ee260 on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.629% (-0.006%) from 20.635%
when pulling cb4d1ac on 10633-create-collection-api-ext
into 43ee260 on develop.

This comment has been minimized.

1 similar comment

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.629% (-0.006%) from 20.635%
when pulling cb4d1ac on 10633-create-collection-api-ext
into 43ee260 on develop.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.635%. remained the same
when pulling b261668 on 10633-create-collection-api-ext
into 43ee260 on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.637% (+0.002%) from 20.635%
when pulling b261668 on 10633-create-collection-api-ext
into 43ee260 on develop.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.643% (+0.008%) from 20.635%
when pulling b261668 on 10633-create-collection-api-ext
into 43ee260 on develop.

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.637% (+0.002%) from 20.635%
when pulling f4168f4 on 10633-create-collection-api-ext
into 43ee260 on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.637% (+0.002%) from 20.635%
when pulling f4168f4 on 10633-create-collection-api-ext
into 43ee260 on develop.

This comment has been minimized.

1 similar comment

This comment has been minimized.

@coveralls
Copy link

Coverage Status

coverage: 20.777% (+0.1%) from 20.635%
when pulling e65eb9f on 10633-create-collection-api-ext
into 43ee260 on develop.

2 similar comments
@coveralls
Copy link

Coverage Status

coverage: 20.777% (+0.1%) from 20.635%
when pulling e65eb9f on 10633-create-collection-api-ext
into 43ee260 on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.777% (+0.1%) from 20.635%
when pulling e65eb9f on 10633-create-collection-api-ext
into 43ee260 on develop.

This comment has been minimized.

@GPortas GPortas marked this pull request as ready for review July 2, 2024 15:14
@GPortas GPortas added Size: 10 A percentage of a sprint. 7 hours. SPA These changes are required for the Dataverse SPA GREI Re-arch Issues related to the GREI Dataverse rearchitecture labels Jul 2, 2024
@coveralls
Copy link

Coverage Status

coverage: 20.635% (+0.009%) from 20.626%
when pulling d2140e1 on 10633-create-collection-api-ext
into b42222f on develop.

2 similar comments
@coveralls
Copy link

Coverage Status

coverage: 20.635% (+0.009%) from 20.626%
when pulling d2140e1 on 10633-create-collection-api-ext
into b42222f on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.635% (+0.009%) from 20.626%
when pulling d2140e1 on 10633-create-collection-api-ext
into b42222f on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.635% (+0.009%) from 20.626%
when pulling d2140e1 on 10633-create-collection-api-ext
into b42222f on develop.

2 similar comments
@coveralls
Copy link

Coverage Status

coverage: 20.635% (+0.009%) from 20.626%
when pulling d2140e1 on 10633-create-collection-api-ext
into b42222f on develop.

@coveralls
Copy link

Coverage Status

coverage: 20.635% (+0.009%) from 20.626%
when pulling d2140e1 on 10633-create-collection-api-ext
into b42222f on develop.

Copy link

github-actions bot commented Jul 2, 2024

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:10633-create-collection-api-ext
ghcr.io/gdcc/configbaker:10633-create-collection-api-ext

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GREI Re-arch Issues related to the GREI Dataverse rearchitecture Size: 10 A percentage of a sprint. 7 hours. SPA These changes are required for the Dataverse SPA
Projects
Status: Ready for Review ⏩
Development

Successfully merging this pull request may close these issues.

Extend create collection API endpoint to include facet list and input level list
2 participants