Skip to content

feat: support deeply nested metadata fields when creating and updating datasets - #510

Open
vera wants to merge 3 commits into
IQSS:developfrom
vera:feat/write-nested-metadata
Open

vera wants to merge 3 commits into
IQSS:developfrom
vera:feat/write-nested-metadata

Conversation

@vera

@vera vera commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Adds support for writing deeply nested metadata fields using the use cases createDataset and updateDataset.

Counterpart to #478, which covers the reading of deeply nested metadata fields.

Which issue(s) this PR closes:

None

Related Dataverse PRs:

None

Special notes for your reviewer:

None

Suggestions on how to test this:

Create and update a dataset with deeply nested compound metadata. Verify validation and saved values.

I've added test cases for the new behaviour.

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

Yes, included under [Unreleased]

Additional documentation:

None

@vera vera changed the title Feat/write nested metadata feat: support deeply nested metadata fields when creating and updating datasets Nov 27, 2026
@ChengShi-1
ChengShi-1 self-requested a review November 30, 2026 16:05
@ChengShi-1 ChengShi-1 self-assigned this Nov 30, 2026
const value: string = datasetMetadataChildFieldValue[metadataChildFieldKey] as unknown as string
metadataChildFieldRequestPayload[metadataChildFieldKey] = {
value: value,
value: transformMetadataFieldValueToRequestPayload(

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.

There is a misspelled nested key passes validation, then crashes serialization with a TypeError because the child field definition is missing.

Could we reject unknown keys during recursive validation and include the field path in the ResourceValidationError?

return result
}

private hasValue(value: DatasetMetadataFieldValueDTO | undefined): boolean {

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.

The validator’s empty-value check covers missing values, blank strings, and empty arrays. An empty object {} falls through, so a required compound passes if all its children are optional.

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.

a required nested compound with only optional children passes validation when submitted as {}. The SDK serializes the empty object, and Dataverse’s parser produces no compound value for it. Could we reuse the recursive value check for required compounds and add a test that starts with an API-shaped metadata schema? The new tests build the schema model directly and only assert serialization.

@ChengShi-1 ChengShi-1 added Size: 3 A percentage of a sprint. 2.1 hours. SPA labels Nov 30, 2026
@ChengShi-1 ChengShi-1 moved this to In Review 🔎 in IQSS Dataverse Project Nov 30, 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