feat: prevent draft creation for unchanged dataset metadata#12452
Open
AnneGerlach wants to merge 1 commit into
Open
feat: prevent draft creation for unchanged dataset metadata#12452AnneGerlach wants to merge 1 commit into
AnneGerlach wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
🎫 Closes: #12376
This PR prevents Dataverse from creating or updating a draft version when metadata uploaded via
PUT /api/datasets/{id}/versions/:draftis semantically identical to the existing dataset version.Previously, repeated uploads of unchanged metadata created unnecessary draft versions. This was particularly problematic for automated synchronization workflows, which had to implement their own comparison logic before submitting updates.
The implementation reuses the existing
DatasetVersionDifferencelogic to detect unchanged metadata and terms updates and skips draft creation or update when no effective changes are detected.Changes
Added a no-op check before draft creation and draft update in
PUT /api/datasets/{id}/versions/:draftReused the existing
DatasetVersionDifferenceimplementation to detect unchanged metadata and terms updatesSkipped draft creation/update and returned the existing dataset version when no effective changes are detected
Added integration tests covering both scenarios:
Suggestions on how to test this:
Run tests:
mvn test -Dtest=DatasetsTest,DatasetsITor tests manually:
Test no-op metadata update
dataverseAdminTest changed metadata
# Modify metadata in the file e.g. nano latestVersion.jsonSpecial notes for your reviewer:
Thanks for reviewing 🌻 (and special thanks to @vera for reviewing beforehand 🌷 )