Skip to content

Edit Metadata API endpoint - support empty values#11273

Merged
ofahimIQSS merged 37 commits intodevelopfrom
11243-editmetadata-api-empty-values
Mar 20, 2025
Merged

Edit Metadata API endpoint - support empty values#11273
ofahimIQSS merged 37 commits intodevelopfrom
11243-editmetadata-api-empty-values

Conversation

@GPortas
Copy link
Contributor

@GPortas GPortas commented Feb 19, 2025

What this PR does / why we need it:

Extended the Edit Metadata API endpoint:

  • This endpoint now allows removing fields (by sending empty values), as long as they are not required by the dataset.
  • New sourceInternalVersionNumber optional query parameter, which prevents inconsistencies by managing updates that may occur from other users while a dataset is being edited.

A significant part of the changes involve refactoring the previous logic and addressing missing test coverage (Coveralls reports a +0.1% increase in coverage with these changes). Since I needed to modify the metadata validation logic and its update process, I first had to ensure that the underlying logic was both testable and extensible.

Which issue(s) this PR closes:

Special notes for your reviewer:

I have identified some areas for improvement in the field validation. For example, as mentioned in my original message on Slack:

It looks like the API currently allows editing multiple fields in a dataset's metadata by setting empty values (e.g. ["", ""]) (https://github.com/IQSS/dataverse/blob/develop/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java#L1188), since the only check performed is that the list is not empty ([]). However, in the case of single fields, it ensures that the string is not empty (https://github.com/IQSS/dataverse/blob/develop/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java#L1191).
Is this intended behavior? Or should the API also check that the values in the list are not empty? This will change in the context of #11243, but I’d like to clarify the current expected behavior.

Finally, I have decided not to implement any changes to the validation logic aside from those necessary for field removal, in order to avoid overextending the scope of this PR and further delaying it. I am willing to create separate issues to apply the enhancements in the future if necessary.

Suggestions on how to test this:

Follow the updated docs for Edit Metadata API endpoint.

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

No

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

Yes, attached.

Additional documentation:

None

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@GPortas GPortas force-pushed the 11243-editmetadata-api-empty-values branch from 86da8d6 to 77f94d0 Compare February 19, 2025 14:04
@github-actions

This comment has been minimized.

…d dataset field types in DatasetFieldValidator
@github-actions

This comment has been minimized.

@coveralls
Copy link

coveralls commented Feb 21, 2025

Coverage Status

coverage: 22.754% (+0.1%) from 22.614%
when pulling e597914 on 11243-editmetadata-api-empty-values
into 23780ba on develop.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@GPortas GPortas added the FY25 Sprint 18 FY25 Sprint 18 (2025-02-26 - 2025-03-12) label Mar 6, 2025
@github-actions

This comment has been minimized.

@cmbz cmbz added the FY25 Sprint 19 FY25 Sprint 19 (2025-03-12 - 2025-03-26) label Mar 12, 2025
@stevenwinship stevenwinship self-assigned this Mar 18, 2025
@stevenwinship stevenwinship moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Mar 18, 2025
@GPortas GPortas requested a review from stevenwinship March 19, 2025 12:11
@GPortas GPortas removed their assignment Mar 19, 2025
@GPortas
Copy link
Contributor Author

GPortas commented Mar 19, 2025

@stevenwinship Thanks for the review. I just updated the JSON strings.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11243-editmetadata-api-empty-values
ghcr.io/gdcc/configbaker:11243-editmetadata-api-empty-values

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

@github-project-automation github-project-automation bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Mar 19, 2025
@stevenwinship stevenwinship removed their assignment Mar 19, 2025
@ofahimIQSS
Copy link
Contributor

tests passing in local - merging PR

@ofahimIQSS ofahimIQSS merged commit 5fbfea2 into develop Mar 20, 2025
22 checks passed
@ofahimIQSS ofahimIQSS deleted the 11243-editmetadata-api-empty-values branch March 20, 2025 18:34
@github-project-automation github-project-automation bot moved this from Ready for QA ⏩ to Merged 🚀 in IQSS Dataverse Project Mar 20, 2025
@pdurbin pdurbin added this to the 6.7 milestone Mar 20, 2025
@scolapasta scolapasta moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY25 Sprint 18 FY25 Sprint 18 (2025-02-26 - 2025-03-12) FY25 Sprint 19 FY25 Sprint 19 (2025-03-12 - 2025-03-26) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Original size: 10 Size: 10 A percentage of a sprint. 7 hours. SPA.Q1 Not related to any specific Q1 feature SPA These changes are required for the Dataverse SPA

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

Edit Metadata API endpoint - not allowing empty values

6 participants