Skip to content

Fix metadata value comparison and replacement in editMetadata API - #12936

Open
vera wants to merge 4 commits into
IQSS:developfrom
vera:fix/update-dataset-fields
Open

vera wants to merge 4 commits into
IQSS:developfrom
vera:fix/update-dataset-fields

Conversation

@vera

@vera vera commented Nov 27, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Fixes metadata updates that incorrectly skip distinct values when they are substrings of existing values. Uses value-based comparison for text, controlled vocabulary, and compound fields using valuesEqual. Also, fixes field clearing when replacing metadata.

Changes:

  • ControlledVocabularyValue.java: Added valuesEqual to compare vocabulary values by text rather than database identity.
  • DatasetFieldCompoundValue.java: Updated valuesEqual to detect equality of compound entries correctly, including nested values, while ignoring order and empty children.
  • UpdateDatasetFieldsCommand.java: Replaced display-text substring checks with value comparisons using valuesEqual to avoid skipping distinct values, and fixed field resets to correctly replace existing metadata.

Which issue(s) this PR closes:

Closes #7605

Special notes for your reviewer:

None

Suggestions on how to test this:

I added/extended UpdateDatasetFieldsCommandTest and DatasetFieldCompoundValueTest.

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?:

I will add a small bug fix release note.

Additional documentation:

/

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit metadata API: doesn't add or replace if the value "contains" the current value

1 participant