Skip to content

Commit 9aed0f6

Browse files
authored
fix(dataset): prevent duplicate metadata keys when renaming (#2547)
## Description This PR fixes an issue where renaming scientific metadata keys in the V4 dataset would create duplicate metadata key records instead of updating the existing one. The problem occurred because the default content-type was set to "application/merge-patch+json", which merges new keys with existing ones rather than replacing them. By changing the default content-type to "application/json", users must now provide all the metadata keys for the specific dataset when updating, as the new metadata will replace the old ones completely. Users can still use "application/merge-patch+json" by explicitly setting the content-type header if they need merge behavior. ## Motivation <!-- Background on use case, changes needed --> ## Fixes <!-- Please provide a list of the issues fixed by this PR --> * Bug fixed (#X) ## Changes: <!-- Please provide a list of the changes implemented by this PR --> * changes made ## Tests included - [ ] Included for each change/fix? - [ ] Passing? <!-- Merge will not be approved unless tests pass --> ## Documentation - [ ] swagger documentation updated (required for API changes) - [ ] official documentation updated ### official documentation info <!-- If you have updated the official documentation, please provide PR # and URL of the updated pages -->
2 parents eccb917 + aad7a8a commit 9aed0f6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/datasets/datasets.v4.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ Set \`content-type\` header to \`application/merge-patch+json\` if you would lik
769769
description: "Id of the dataset to modify",
770770
type: String,
771771
})
772-
@ApiConsumes("application/merge-patch+json", "application/json")
772+
@ApiConsumes("application/json", "application/merge-patch+json")
773773
@ApiBody({
774774
description:
775775
"Fields that needs to be updated in the dataset. Only the fields that needs to be updated have to be passed in.",

0 commit comments

Comments
 (0)