Piccolo-api

Latest version: v1.4.0

Safety actively analyzes 630169 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 8 of 21

0.32.0

------

Added support for the ``Content-Range`` HTTP header in the GET endpoint of
``PiccoloCRUD``. This means the API client can fetch the number of available
rows, without doing a separate API call to the ``count`` endpoint.

.. code-block::

GET /?__range_header=true

If the page size is 10, then the response header then looks something like:

.. code-block::

Content-Range: movie 0-9/100

The feature was created to make Piccolo APIs work better with front ends like
`React Admin <https://marmelab.com/react-admin/>`_.

Thanks to trondhindenes for adding this feature, and sinisaos for help
reviewing.

-------------------------------------------------------------------------------

0.31.0

------

Added hooks to ``PiccoloCRUD``. This allows the user to add their own logic
before a save / patch / delete (courtesy trondhindenes).

For example:

.. code-block:: python

Normal functions and async functions are supported:
def pre_save_hook(movie):
movie.rating = 90
return movie

PiccoloCRUD(
table=Movie,
read_only=False,
hooks=[
Hook(hook_type=HookType.pre_save, callable=pre_save_hook)
]
)

-------------------------------------------------------------------------------

0.30.1

------

* Streamlined the ``CSRFMiddleware`` code, and added missing type annotations.
* If using the ``__visible_fields`` parameter with ``PiccoloCRUD``, and the
field name is unrecognised, the error response will list the correct field
names.
* Improved test coverage (courtesy sinisaos).

-------------------------------------------------------------------------------

0.30.0

------

We recently added the ``__visible_fields`` GET parameter to ``PiccoloCRUD``,
which allows the user to determine which fields are returned by the API.

However, there was no way of the user knowing which fields were supported. This
is now possible by visiting the ``/schema`` endpoint, which has a
``visible_fields_options`` field which lists the columns available on the table
and related tables (courtesy sinisaos).

-------------------------------------------------------------------------------

0.29.2

------

Fixed a bug with the OpenAPI docs when using ``Array`` columns. Thanks to gmos
for reporting this issue, and sinisaos for fixing it.

-------------------------------------------------------------------------------

0.29.1

------

The ``__visible_fields`` filter on ``PiccoloCRUD`` now works on the detail
endpoint (courtesy sinisaos). For example:

.. code-block:: text

GET /1/?__visible_fields=id,name,director.name

We also modified a type annotation in ``FastAPIWrapper``, so you can use it
with FastAPI's ``APIRouter`` without getting a type warning. Thanks to gmos
for reporting this issue.

-------------------------------------------------------------------------------

Page 8 of 21

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.