Skip to content

Commit

Permalink
fix(update): add json-merge-patch guidance for HTTP
Browse files Browse the repository at this point in the history
After offline discussion, it was agreed upon that IETF RFC 7396 (JSON Merge Patch) is the more sensible choice for a partial update on an HTTP+JSON API. The rationale includes:

- can generally be expressed via protobuf field masks.
- aligns with the AEPs usage of resource-oriented guidance.
- aligns with an existing IETF standard, which as already been widely adopted.
  • Loading branch information
toumorokoshi committed Nov 19, 2024
1 parent 14c600b commit cba1427
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions aep/general/0134/aep.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ Update methods implement a common request pattern:

{% sample '../example.oas.yaml', '$.paths./publishers.post.requestBody' %}

- The method **must** adhere to the behavior specified in [IETF RFC 7396 - JSON
Merge Patch](https://datatracker.ietf.org/doc/html/rfc7396).
- The method **must** support MIME types `application/merge-patch+json` to
adhere to IETF RFC 7396. The method **may** support `application/json` as a
common generalization.

{% endtabs %}

### Responses
Expand Down
8 changes: 4 additions & 4 deletions aep/general/example.oas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ paths:
type: string
requestBody:
content:
application/json:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/publisher'
required: true
responses:
'200':
content:
application/json:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/publisher'
description: Successful response
Expand Down Expand Up @@ -311,14 +311,14 @@ paths:
type: string
requestBody:
content:
application/json:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/book'
required: true
responses:
'200':
content:
application/json:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/book'
description: Successful response
Expand Down

0 comments on commit cba1427

Please sign in to comment.