Skip to content

Commit 84c3c9c

Browse files
committed
update docs
1 parent 3b1c74d commit 84c3c9c

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

docs/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ Response:
234234
:language: HTTP
235235

236236

237-
If you want to see more examples go to `JSON API 1.0 specification <http://jsonapi.org/>`_
237+
If you want to see more examples visit `JSON API 1.0 specification <http://jsonapi.org/>`_

flask_combo_jsonapi/resource.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,11 @@ def _get_validated_json_payload(self, related_type_) -> dict:
419419

420420
@check_method_requirements
421421
def post(self, *args, **kwargs):
422-
"""Add / create relationship(s)"""
422+
"""
423+
Add / create relationship(s)
424+
425+
https://jsonapi.org/format/#crud-updating-to-many-relationships
426+
"""
423427
relationship_field, model_relationship_field, related_type_, related_id_field = self._get_relationship_data()
424428
json_data = self._get_validated_json_payload(related_type_)
425429
self.before_post(args, kwargs, json_data=json_data)
@@ -441,7 +445,23 @@ def post(self, *args, **kwargs):
441445

442446
@check_method_requirements
443447
def patch(self, *args, **kwargs):
444-
"""Update a relationship"""
448+
"""
449+
Update a relationship
450+
451+
# https://jsonapi.org/format/#crud-updating-relationship-responses-200
452+
453+
> If a server accepts an update but also changes the targeted relationship(s)
454+
> in other ways than those specified by the request,
455+
> it MUST return a 200 OK response.
456+
> The response document MUST include a representation
457+
> of the updated relationship(s).
458+
459+
> A server MUST return a 200 OK status code if an update is successful,
460+
> the client’s current data remain up to date,
461+
> and the server responds only with top-level meta data.
462+
> In this case the server MUST NOT include a representation
463+
> of the updated relationship(s).
464+
"""
445465
relationship_field, model_relationship_field, related_type_, related_id_field = self._get_relationship_data()
446466

447467
json_data = self._get_validated_json_payload(related_type_)

0 commit comments

Comments
 (0)