Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changelog
#########

**2.4.2**
*********

Separate helper methods for relationships query
===============================================

* fix run validator: sometimes it requires model field by `@mahenzon`_ in `#70 <https://github.com/mts-ai/FastAPI-JSONAPI/pull/70>`_

Authors
"""""""

* `@mahenzon`_

**2.4.1**
*********

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
# The short X.Y version.
version = "2.4"
# The full version, including alpha/beta/rc tags.
release = "2.4.1"
release = "2.4.2"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
116 changes: 57 additions & 59 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,61 +24,61 @@ An example of FastAPI-JSONAPI API looks like this:

This example provides the following API:

+----------------+--------+----------------+---------------------------------+
| url | method | endpoint | action |
+================+========+================+=================================+
| /users | GET | user_list | Retrieve a collection of users |
+----------------+--------+----------------+---------------------------------+
| /users | POST | user_list | Create a user |
+----------------+--------+----------------+---------------------------------+
| /users/<int:id> | GET | user_detail | Retrieve details of a user |
+----------------+--------+----------------+---------------------------------+
| /users/<int:id> | PATCH | user_detail | Update a user |
+----------------+--------+----------------+---------------------------------+
| /users/<int:id> | DELETE | user_detail | Delete a user |
+----------------+--------+----------------+---------------------------------+
+-----------------+--------+-------------+--------------------------------+
| url | method | endpoint | action |
+=================+========+=============+================================+
| /users | GET | user_list | Retrieve a collection of users |
+-----------------+--------+-------------+--------------------------------+
| /users | POST | user_list | Create a user |
+-----------------+--------+-------------+--------------------------------+
| /users/<int:id> | GET | user_detail | Retrieve details of a user |
+-----------------+--------+-------------+--------------------------------+
| /users/<int:id> | PATCH | user_detail | Update a user |
+-----------------+--------+-------------+--------------------------------+
| /users/<int:id> | DELETE | user_detail | Delete a user |
+-----------------+--------+-------------+--------------------------------+

in developing

+-------------------------------------------+--------+------------------+------------------------------------------------------+
| url | method | endpoint | action |
+===========================================+========+==================+======================================================+
| /users/<int:id>/group | GET | computer_list | Retrieve a collection computers related to a user |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /users/<int:id>/group | POST | computer_list | Create a computer related to a user |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /users/<int:id>/relationships/group | GET | user_computers | Retrieve relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /users/<int:id>/relationships/computers | POST | user_computers | Create relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /users/<int:id>/relationships/computers | PATCH | user_computers | Update relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /users/<int:id>/relationships/computers | DELETE | user_computers | Delete relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers | GET | computer_list | Retrieve a collection of computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers | POST | computer_list | Create a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id> | GET | computer_detail | Retrieve details of a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id> | PATCH | computer_detail | Update a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id> | DELETE | computer_detail | Delete a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/owner | GET | user_detail | Retrieve details of the owner of a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/owner | PATCH | user_detail | Update the owner of a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/owner | DELETE | user_detail | Delete the owner of a computer |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/relationships/owner | GET | user_computers | Retrieve relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/relationships/owner | POST | user_computers | Create relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/relationships/owner | PATCH | user_computers | Update relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
| /computers/<int:id>/relationships/owner | DELETE | user_computers | Delete relationships between a user and computers |
+-------------------------------------------+--------+------------------+------------------------------------------------------+
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| url | method | endpoint | action |
+=========================================+========+=================+=====================================================+
| /users/<int:id>/group | GET | computer_list | Retrieve a collection computers related to a user |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /users/<int:id>/group | POST | computer_list | Create a computer related to a user |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /users/<int:id>/relationships/group | GET | user_computers | Retrieve relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /users/<int:id>/relationships/computers | POST | user_computers | Create relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /users/<int:id>/relationships/computers | PATCH | user_computers | Update relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /users/<int:id>/relationships/computers | DELETE | user_computers | Delete relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers | GET | computer_list | Retrieve a collection of computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers | POST | computer_list | Create a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id> | GET | computer_detail | Retrieve details of a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id> | PATCH | computer_detail | Update a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id> | DELETE | computer_detail | Delete a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/owner | GET | user_detail | Retrieve details of the owner of a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/owner | PATCH | user_detail | Update the owner of a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/owner | DELETE | user_detail | Delete the owner of a computer |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/relationships/owner | GET | user_computers | Retrieve relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/relationships/owner | POST | user_computers | Create relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/relationships/owner | PATCH | user_computers | Update relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+
| /computers/<int:id>/relationships/owner | DELETE | user_computers | Delete relationships between a user and computers |
+-----------------------------------------+--------+-----------------+-----------------------------------------------------+


Save `this file <https://github.com/mts-ai/FastAPI-JSONAPI/blob/main/examples/api_for_sqlalchemy/main.py>`_ as api.py and run it using your Python interpreter. Note that we've enabled
Expand Down Expand Up @@ -154,13 +154,11 @@ Response:
Relationships
-------------

| Now let's use relationships tools.
| First, create 3 computers named "Halo", "Nestor" and "Commodore".
|
| Done?
| Ok. So let's continue this tutorial.
|
| We assume that Halo has id=2, Nestor id=3 and Commodore id=4.
.. note::
Now let's use relationships tools.
First, create 3 computers named "Halo", "Nestor" and "Commodore".
We assume that Halo has id=2, Nestor id=3 and Commodore id=4.


Create object with related object(s)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion fastapi_jsonapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fastapi_jsonapi.exceptions.json_api import HTTPException
from fastapi_jsonapi.querystring import QueryStringManager

__version__ = "2.4.1"
__version__ = "2.4.2"

__all__ = [
"init",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ packages = [

[tool.poetry]
name = "fastapi-jsonapi"
version = "2.4.1"
version = "2.4.2"
description = "FastAPI extension to create REST web api according to JSON:API specification"
authors = [
"Aleksei Nekrasov <[email protected]>",
Expand Down