From b2e4611919f74568475bb10c1605b080a0b0ee45 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Thu, 6 Feb 2025 10:39:09 -0600 Subject: [PATCH] Update metadata-patch.md to describe replace better --- metadata-patch.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/metadata-patch.md b/metadata-patch.md index 19e65cbb..da016729 100644 --- a/metadata-patch.md +++ b/metadata-patch.md @@ -47,7 +47,7 @@ With the `add` operation, you can add any number of metadata values in a single You also use `add` to effectively _replace_ all values for a given metadata key, by specifying an already-present key as the `path`, and an array of your replacement values as the `value`. -This use of the add operation to replace a list of values may be counter-intiutive, but it +This use of the add operation to replace a list of values may be counter-intuitive, but it is done according to the [RFC section 4.1](https://tools.ietf.org/html/rfc6902#section-4.1) > If the target location specifies an object member that does exist, that member's value is replaced. @@ -142,14 +142,12 @@ New metadata state: ## Replacing metadata -With `replace`, you can overwrite any of the following within a single operation -of a PATCH request: - -* The entire set of all object metadata (`path="/metadata"`) -* All metadata values for an existing key (e.g. `path="/metadata/dc.title"`) +With `replace`, you can overwrite a value at a given target location in a PATCH request: * A single existing metadata value (e.g. `path="/metadata/dc.title/0"`) * A single property of an existing value (e.g. `path="/metadata/dc.title/0/language"`) +(NOTE: If you are wanting to replace _all values_ of a given metadata field, you should use the `add` operation with an array of values as documented above.) + Example request, replacing the `value` and `language` of the first `dc.title`: ```json