Repository navigation
Conversation
| const value: string = datasetMetadataChildFieldValue[metadataChildFieldKey] as unknown as string | ||
| metadataChildFieldRequestPayload[metadataChildFieldKey] = { | ||
| value: value, | ||
| value: transformMetadataFieldValueToRequestPayload( |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
What this PR does / why we need it:
Adds support for writing deeply nested metadata fields using the use cases
createDatasetandupdateDataset.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