-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated serialization docs * fixing session auth tests
- Loading branch information
Showing
2 changed files
with
32 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,13 @@ | ||
Serializers | ||
=========== | ||
|
||
``PiccoloCRUD`` uses `Pydantic <https://github.com/samuelcolvin/pydantic>`_ | ||
internally to serialize and deserialize data. | ||
``PiccoloCRUD`` uses ``create_pydantic_model`` to serialize and deserialize data. | ||
|
||
create_pydantic_model | ||
--------------------- | ||
|
||
By using ``create_pydantic_model`` we can very easily create a `Pydantic model <https://pydantic-docs.helpmanual.io/usage/models/>`_ | ||
from a Piccolo ``Table``. | ||
|
||
When using ``PiccoloCRUD``, you don't have to worry about this - it's all | ||
handled internally. However, ``create_pydantic_model`` is very useful when | ||
When using ``PiccoloCRUD``, you don't have to worry about serialisation because ``PiccoloCRUD`` | ||
internally uses ``create_pydantic_model`` to create a `Pydantic model <https://pydantic-docs.helpmanual.io/usage/models/>`_ | ||
from a Piccolo ``Table``. However, ``create_pydantic_model`` is very useful when | ||
integrating Piccolo with a framework such as `FastAPI <https://github.com/tiangolo/fastapi>`_, | ||
which also uses Pydantic for serialisation. | ||
|
||
Source | ||
~~~~~~ | ||
|
||
.. automodule:: piccolo_api.crud.serializers | ||
:members: | ||
|
||
FastAPI template | ||
~~~~~~~~~~~~~~~~ | ||
|
||
To create a new FastAPI app using Piccolo, simply use: | ||
|
||
.. code-block:: bash | ||
piccolo asgi new | ||
This uses ``create_pydantic_model`` to create serializers. | ||
which also uses `Pydantic <https://github.com/samuelcolvin/pydantic>`_ for serialisation. | ||
|
||
See the `Piccolo ASGI docs <https://piccolo-orm.readthedocs.io/en/latest/piccolo/asgi/index.html>`_ | ||
for details. | ||
See the `create_pydantic_model docs <https://piccolo-orm.readthedocs.io/en/latest/piccolo/serialization/index.html>`_ | ||
for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters