Skip to content

Commit

Permalink
v2.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut committed Mar 2, 2024
1 parent 6b61105 commit de5129b
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
89 changes: 89 additions & 0 deletions docs/release-notes/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,95 @@
2.x Changelog
=============

.. changelog:: 2.6.2
:date: 2024/03/02

.. change:: DTO msgspec meta constraints not being included in transfer model
:type: bugfix
:pr: 3113
:issue: 3026

Fix an issue where msgspec constraints set in ``msgspec.Meta`` would not be
honoured by the DTO.

In the given example, the ``min_length=3`` constraint would be ignored by the
model generated by ``MsgspecDTO``.

.. code-block:: python
from typing import Annotated
import msgspec
from litestar import post, Litestar
from litestar.dto import MsgspecDTO
class Request(msgspec.Struct):
foo: Annotated[str, msgspec.Meta(min_length=3)]
@post("/example/", dto=MsgspecDTO[Request])
async def example(data: Request) -> Request:
return data
Constraints like these are now transferred.

Two things to note are:

- For DTOs with ``DTOConfig(partial=True)`` we cannot transfer the length
constraints as they are only supported on fields that as subtypes of ``str``,
``bytes`` or a collection type, but ``partial=True`` sets all fields as
``T | UNSET``
- For the ``PiccoloDTO``, fields which are not required will also drop the
length constraints. A warning about this will be raised here.

.. change:: Missing control header for static files
:type: bugfix
:pr: 3131
:issue: 3129

Fix an issue where a ``cache_control`` that is set on a router created by
``create_static_files_router`` wasn't passed to the generated handler

.. change:: Fix OpenAPI schema generation for Pydantic v2 constrained ``Secret`` types
:type: bugfix
:pr: 3149
:issue: 3148

Fix schema generation for ``pydantic.SecretStr`` and ``pydantic.SecretBytes``
which, when constrained, would not be recognised as such with Pydantic V2 since
they're not subtypes of their respective bases anymore.

.. change:: Fix OpenAPI schema generation for Pydantic private attributes
:type: bugfix
:pr: 3151
:issue: 3150

Fix a bug that caused a :exc:`NameError` when trying to resolve forward
references in Pydantic private fields.

Although private fields were respected excluded from the schema, it was still
attempted to extract their type annotation. This was fixed by not relying on
``typing.get_type_hints`` to get the type information, but instead using
Pydantic's own APIs, allowing us to only extract information about the types of
relevant fields.

.. change:: OpenAPI description not set for UUID based path parameters in OpenAPI
:type: bugfix
:pr: 3118
:issue: 2967

Resolved a bug where the description was not set for UUID-based path
parameters in OpenAPI due to the reason mentioned in the issue.

.. change:: Fix ``RedisStore`` client created with ``with_client`` unclosed
:type: bugfix
:pr: 3111
:issue: 3083

Fix a bug where, when a :class:`~litestar.stores.redis.RedisStore` was created
with the :meth:`~litestar.stores.redis.RedisStore.with_client` method, that
client wasn't closed explicitly


.. changelog:: 2.6.1
:date: 2024/02/14

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ maintainers = [
name = "litestar"
readme = "README.md"
requires-python = ">=3.8,<4.0"
version = "2.6.1"
version = "2.6.2"

[project.urls]
Blog = "https://blog.litestar.dev"
Expand Down

0 comments on commit de5129b

Please sign in to comment.