Skip to content

feat: allow partial updates via updateDataset - #511

Open
vera wants to merge 1 commit into
IQSS:developfrom
vera:feat/partial-dataset-update
Open

vera wants to merge 1 commit into
IQSS:developfrom
vera:feat/partial-dataset-update

Conversation

@vera

@vera vera commented Nov 27, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Allows partial metadata updates through updateDataset. Omitted fields retain their values. Only the actually supplied fields are validated.

Previously, a partial metadata update would fail with a validation error if it was any missing mandatory fields.

Which issue(s) this PR closes:

None

Related Dataverse PRs:

None

Special notes for your reviewer:

None

Suggestions on how to test this:

Update e.g. only a dataset’s title and verify omitted fields are preserved.

I added new functional and unit test cases for this.

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

Yes, included under "Unreleased"

Additional documentation:

Updated docs/useCases.md to describe the partial-update behavior and updated the example.

@ChengShi-1 ChengShi-1 self-assigned this Nov 30, 2026
)
})

describe('when validating a partial update', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for partialUpdate(fields:{ })

Comment thread docs/useCases.md
Updates an existing Dataset, given a [DatasetDTO](../src/datasets/domain/dtos/DatasetDTO.ts) with the updated information.

If a draft of the dataset already exists, the metadata of that draft is overwritten; otherwise, a new draft is created with the updated metadata.
If a draft of the dataset already exists, only the supplied metadata fields are replaced; otherwise, a new draft is created with the updated metadata. Omitted fields retain their existing values, including required fields. Supplied compound fields and arrays replace the entire field value, so include any existing entries you want to keep.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty patch fields: {} leaves metadata values unchanged, but the save can still create a draft or update lastUpdateTime. Could you clarify this in the docs?

@ChengShi-1 ChengShi-1 added the Size: 3 A percentage of a sprint. 2.1 hours. label Dec 1, 2026
@ChengShi-1 ChengShi-1 moved this to Ready for Review ⏩ in IQSS Dataverse Project Dec 1, 2026
@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Dec 1, 2026
@ChengShi-1 ChengShi-1 added the SPA label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: 3 A percentage of a sprint. 2.1 hours. SPA

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

2 participants