diff --git a/CHANGELOG.md b/CHANGELOG.md index b4981ee..fabcd97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- Support for [RFC 6902](https://tools.ietf.org/html/rfc6902) [#14](https://github.com/stac-api-extensions/transaction/pull/14) + +### Changed + +- Updated of [RFC 7386](https://tools.ietf.org/html/rfc7386) to [RFC 7396](https://tools.ietf.org/html/rfc7396) [#14](https://github.com/stac-api-extensions/transaction/pull/14) + ## [v1.0.0-rc.3] - 2023-09-28 - Remove assertion that this will align with OAF Part 4. diff --git a/README.md b/README.md index 4face4e..3e7ba12 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,9 @@ All cases: - Must return 404 if no Item exists for this resource URI. - If the `id` or `collection` fields are different from those in the URI, status code 400 shall be returned. -PATCH is compliant with [RFC 7386](https://tools.ietf.org/html/rfc7386). +The default standard for PATCH is [RFC 7396](https://tools.ietf.org/html/rfc7396). +Optionally, in addition to RFC 7396, [RFC 6902](https://tools.ietf.org/html/rfc6902) can be supported with the two methods +being distinguished via the Accept/Content-Type header. ### DELETE diff --git a/openapi.yaml b/openapi.yaml index 7073329..8e96084 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -22,7 +22,7 @@ paths: - $ref: "https://api.stacspec.org/v1.0.0/ogcapi-features/openapi.yaml#/components/parameters/collectionId" post: summary: add a new STAC Item or Items in an ItemCollection to a collection - description: create a new STAC Item r Items in an ItemCollection in a specific collection + description: create a new STAC Item or Items in an ItemCollection in a specific collection operationId: postFeature tags: - Transaction @@ -137,8 +137,12 @@ paths: patch: summary: update an existing feature by Id with a partial item definition description: >- - Use this method to update an existing feature. Requires a GeoJSON - fragment (containing the fields to be updated) be submitted. + Use this method to update an existing feature. The default method, merge-patch adheres to RF7396 + and requires a GeoJSON fragment (containing the fields to be updated) be submitted. Null values in + the merge patch are given special meaning to indicate the removal of existing values in the + target. Optionally json-patch, which adheres to RF6902 and requires a sequence of opperations to + perform on the target feature, can be included. The two methods can be distinguished via the + Accept/Content-Type header. operationId: patchFeature tags: - Transaction @@ -148,10 +152,16 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/patchItem" + $ref: "#/components/schemas/mergePatchItem" + application/merge-patch+json: + schema: + $ref: "#/components/schemas/mergePatchItem" + application/json-patch+json: + schema: + $ref: "#/components/schemas/patchRequest" responses: "200": - description: The item was replaced + description: The item was updated headers: ETag: schema: @@ -162,7 +172,7 @@ paths: schema: $ref: "https://api.stacspec.org/v1.0.0/ogcapi-features/openapi.yaml#/components/schemas/item" "202": - description: The item was accepted for asynchronous action + description: The request was accepted for asynchronous action "204": description: Status of the update request. headers: @@ -228,9 +238,74 @@ components: schema: type: string schemas: - patchItem: + patchRequest: + description: >- + An array that containing the sequence of opperations to apply to the target item. + type: array + items: + oneOf: + - $ref: '#/components/schemas/patchRequestAddReplaceTest' + - $ref: '#/components/schemas/patchRequestRemove' + - $ref: '#/components/schemas/patchRequestMoveCopy' + patchRequestAddReplaceTest: + type: object + additionalProperties: false + required: + - value + - op + - path + properties: + path: + description: A JSON Pointer path. + type: string + value: + description: The value to add, replace or test. + op: + description: The operation to perform. + type: string + enum: + - add + - replace + - test + patchRequestRemove: + type: object + additionalProperties: false + required: + - op + - path + properties: + path: + description: A JSON Pointer path. + type: string + op: + description: The operation to perform. + type: string + enum: + - remove + patchRequestMoveCopy: + type: object + additionalProperties: false + required: + - from + - op + - path + properties: + path: + description: A JSON Pointer path. + type: string + op: + description: The operation to perform. + type: string + enum: + - move + - copy + from: + description: A JSON Pointer path. + type: string + mergePatchItem: description: >- - An object that contains at least a subset of the fields for a STAC Item. + An object that contains at least a subset of the fields for a STAC Item. Null values in the merge + patch are given special meaning to indicate the removal of existing values in the target. type: object properties: stac_version: