Skip to content

Commit 238b3c4

Browse files
chore(release): bump version, edit changelog (#3318)
* chore(release): bump version * Update docs/release-notes/changelog.rst Co-authored-by: Janek Nouvertné <[email protected]> * Update docs/release-notes/changelog.rst Co-authored-by: Janek Nouvertné <[email protected]> * Update docs/release-notes/changelog.rst Co-authored-by: Janek Nouvertné <[email protected]> * chore: apply code review * chore: apply code review * chore: apply code review --------- Co-authored-by: Janek Nouvertné <[email protected]>
1 parent 3c81840 commit 238b3c4

File tree

2 files changed

+213
-7
lines changed

2 files changed

+213
-7
lines changed

docs/release-notes/changelog.rst

+212-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,212 @@
33
2.x Changelog
44
=============
55

6+
.. changelog:: 2.8.0
7+
:date: 2024-04-05
8+
9+
.. change:: Unique schema names for nested models (#3134)
10+
:type: bugfix
11+
:pr: 3136
12+
:issue: 3134
13+
14+
Fixes an issue where nested models beyond the ``max_nested_depth`` would not have
15+
unique schema names in the OpenAPI documentation. The fix appends the nested
16+
model's name to the ``unique_name`` to differentiate it from the parent model.
17+
18+
.. change:: Add ``path`` parameter to Litestar application class
19+
:type: feature
20+
:pr: 3314
21+
22+
Exposes :paramref:`~.app.Litestar.parameter` at :class:`~.app.Litestar` application class level
23+
24+
.. change:: Remove duplicate ``rich-click`` config options
25+
:type: bugfix
26+
:pr: 3274
27+
28+
Removes duplicate config options from click cli
29+
30+
.. change:: Fix Pydantic ``json_schema_extra`` examples.
31+
:type: bugfix
32+
:pr: 3281
33+
:issue: 3277
34+
35+
Fixes a regression introduced in ``2.7.0`` where an example for a field provided in Pydantic's
36+
``Field.json_schema_extra`` would cause an error.
37+
38+
.. change:: Set default on schema from :class:`~.typing.FieldDefinition`
39+
:type: bugfix
40+
:pr: 3280
41+
:issue: 3278
42+
43+
Consider the following:
44+
45+
.. code-block:: python
46+
47+
def get_foo(foo_id: int = 10) -> None:
48+
...
49+
50+
In such cases, no :class:`~.params.KwargDefinition` is created since there is no metadata provided via
51+
``Annotated``. The default is still parsed, and set on the generated ``FieldDefinition``,
52+
however the ``SchemaCreator`` currently only considers defaults that are set on ``KwargDefinition``.
53+
54+
So in such cases, we should fallback to the default set on the ``FieldDefinition`` if there is a valid
55+
default value.
56+
57+
.. change:: Custom types cause serialisation error in exception response with non-JSON media-type
58+
:type: bugfix
59+
:pr: 3284
60+
:issue: 3192
61+
62+
Fixes a bug when using a non-JSON media type (e.g., ``text/plain``),
63+
:class:`~.exceptions.http_exceptions.ValidationException`'s would not get serialized properly because they
64+
would ignore custom ``type_encoders``.
65+
66+
.. change:: Ensure default values are always represented in schema for dataclasses and :class:`msgspec.Struct`\ s
67+
:type: bugfix
68+
:pr: 3285
69+
:issue: 3201
70+
71+
Fixes a bug that would prevent default values for dataclasses and ``msgspec.Struct`` s to be included in the
72+
OpenAPI schema.
73+
74+
.. change:: Pydantic v2 error handling/serialization when for non-Pydantic exceptions
75+
:type: bugfix
76+
:pr: 3286
77+
:issue: 2365
78+
79+
Fixes a bug that would cause a :exc:`TypeError` when non-Pydantic errors are raised during Pydantic's
80+
validation process while using DTOs.
81+
82+
.. change:: Fix OpenAPI schema generation for paths with path parameters of different types on the same path
83+
:type: bugfix
84+
:pr: 3293
85+
:issue: 2700
86+
87+
Fixes a bug that would cause no OpenAPI schema to be generated for paths with path
88+
parameters that only differ on the path parameter type, such as ``/{param:int}``
89+
and ``/{param:str}``. This was caused by an internal representation issue in
90+
Litestar's routing system.
91+
92+
.. change:: Document unconsumed path parameters
93+
:type: bugfix
94+
:pr: 3295
95+
:issue: 3290
96+
97+
Fixes a bug where path parameters not consumed by route handlers would not be included in the OpenAPI schema.
98+
99+
This could/would not include the ``{param}`` in the schema, yet it is still required to be passed
100+
when calling the path.
101+
102+
.. change:: Allow for console output to be silenced
103+
:type: feature
104+
:pr: 3180
105+
106+
Introduces optional environment variables that allow customizing the "Application" name displayed
107+
in the console output and suppressing the initial ``from_env`` or the ``Rich`` info table at startup.
108+
109+
Provides flexibility in tailoring the console output to better integrate Litestar into larger applications
110+
or CLIs.
111+
112+
.. change:: Add flash plugin
113+
:type: feature
114+
:pr: 3145
115+
:issue: 1455
116+
117+
Adds a flash plugin akin to Django or Flask that uses the request state
118+
119+
.. change:: Use memoized :paramref:`~.handlers.HTTPRouteHandler.request_class` and :paramref:`~.handlers.HTTPRouteHandler.response_class` values
120+
:type: feature
121+
:pr: 3205
122+
123+
Uses memoized ``request_class`` and ``response_class`` values
124+
125+
.. change:: Enable codegen backend by default
126+
:type: feature
127+
:pr: 3215
128+
129+
Enables the codegen backend for DTOs introduced in https://github.com/litestar-org/litestar/pull/2388 by default.
130+
131+
.. change:: Added precedence of CLI parameters over envs
132+
:type: feature
133+
:pr: 3190
134+
:issue: 3188
135+
136+
Adds precedence of CLI parameters over environment variables.
137+
Before this change, environment variables would take precedence over CLI parameters.
138+
139+
Since CLI parameters are more explicit and are set by the user,
140+
they should take precedence over environment variables.
141+
142+
.. change:: Only print when terminal is ``TTY`` enabled
143+
:type: feature
144+
:pr: 3219
145+
146+
Sets ``LITESTAR_QUIET_CONSOLE`` and ``LITESTAR_APP_NAME`` in the autodiscovery function.
147+
Also prevents the tabular console output from printing when the terminal is not ``TTY``
148+
149+
.. change:: Support ``schema_extra`` in :class:`~.openapi.spec.parameter.Parameter` and `Body`
150+
:type: feature
151+
:pr: 3204
152+
153+
Introduces a way to modify the generated OpenAPI spec by adding a ``schema_extra`` parameter to the
154+
Parameter and Body classes. The ``schema_extra`` parameter accepts a ``dict[str, Any]`` where the keys correspond
155+
to the keyword parameter names in Schema, and the values are used to override items in the
156+
generated Schema object.
157+
158+
Provides a convenient way to customize the OpenAPI documentation for inbound parameters.
159+
160+
.. change:: Add :class:`typing.TypeVar` expansion
161+
:type: feature
162+
:pr: 3242
163+
164+
Adds a method for TypeVar expansion on registration
165+
This allows the use of generic route handler and generic controller without relying on forward references.
166+
167+
.. change:: Add ``LITESTAR_`` prefix before ``WEB_CONCURRENCY`` env option
168+
:type: feature
169+
:pr: 3227
170+
171+
Adds ``LITESTAR_`` prefix before the ``WEB_CONCURRENCY`` environment option
172+
173+
.. change:: Warn about ambiguous default values in parameter specifications
174+
:type: feature
175+
:pr: 3283
176+
177+
As discussed in https://github.com/litestar-org/litestar/pull/3280#issuecomment-2026878325,
178+
we want to warn about, and eventually disallow specifying parameter defaults in two places.
179+
180+
To achieve this, 2 warnings are added:
181+
182+
- A deprecation warning if a default is specified when using
183+
``Annotated``: ``param: Annotated[int, Parameter(..., default=1)]`` instead of
184+
``param: Annotated[int, Parameter(...)] = 1``
185+
- An additional warning in the above case if two default values are specified which do not match in value:
186+
``param: Annotated[int, Parameter(..., default=1)] = 2``
187+
188+
In a future version, the first one should result in an exception at startup, preventing both of these scenarios.
189+
190+
.. change:: Support declaring :class:`~.dto.field.DTOField` via ``Annotated``
191+
:type: feature
192+
:pr: 3289
193+
:issue: 2351
194+
195+
Deprecates passing :class:`~.dto.field.DTOField` via ``[pydantic]`` extra.
196+
197+
.. change:: Add "TRACE" to HttpMethod enum
198+
:type: feature
199+
:pr: 3294
200+
201+
Adds the ``TRACE`` HTTP method to :class:`~.enums.HttpMethod` enum
202+
203+
.. change:: Pydantic DTO non-instantiable types
204+
:type: feature
205+
:pr: 3296
206+
207+
Simplifies the type that is applied to DTO transfer models for certain Pydantic field types.
208+
It addresses ``JsonValue``, ``EmailStr``, ``IPvAnyAddress``/``IPvAnyNetwork``/``IPvAnyInterface`` types by
209+
using appropriate :term:`type annotations <annotation>` on the transfer models to ensure compatibility with
210+
:doc:`msgspec:index` serialization and deserialization.
211+
6212
.. changelog:: 2.7.1
7213
:date: 2024-03-22
8214

@@ -973,12 +1179,12 @@
9731179
event listeners are now not propagated anymore but handled by the backend and
9741180
logged instead.
9751181

976-
.. change:: Fix OpenAPI schema for pydantic computed fields
1182+
.. change:: Fix OpenAPI schema for Pydantic computed fields
9771183
:type: bugfix
9781184
:pr: 2797
9791185
:issue: 2792
9801186

981-
Add support for including computed fields in schemas generated from pydantic
1187+
Add support for including computed fields in schemas generated from Pydantic
9821188
models.
9831189

9841190
.. changelog:: 2.4.1
@@ -2511,7 +2717,7 @@
25112717
:pr: 1865
25122718
:issue: 1860
25132719

2514-
A regression has been fixed in the pydantic signature model logic, which was
2720+
A regression has been fixed in the Pydantic signature model logic, which was
25152721
caused by the renaming of ``regex`` to ``pattern``, which would lead to the
25162722
:attr:`~litestar.params.KwargDefinition.pattern` not being validated.
25172723

@@ -3446,12 +3652,12 @@
34463652
If you rely on SQLAlchemy 1, you can stick to Starlite *1.51* for now. In the future, a SQLAlchemy 1 plugin
34473653
may be released as a standalone package.
34483654

3449-
.. change:: Fix inconsistent parsing of unix timestamp between pydantic and cattrs
3655+
.. change:: Fix inconsistent parsing of unix timestamp between Pydantic and cattrs
34503656
:type: bugfix
34513657
:pr: 1492
34523658
:issue: 1491
34533659

3454-
Timestamps parsed as :class:`date <datetime.date>` with pydantic return a UTC date, while cattrs implementation
3660+
Timestamps parsed as :class:`date <datetime.date>` with Pydantic return a UTC date, while cattrs implementation
34553661
return a date with the local timezone.
34563662

34573663
This was corrected by forcing dates to UTC when being parsed by attrs.
@@ -4277,4 +4483,4 @@
42774483
:issue: 1149
42784484

42794485
A middleware's ``exclude`` parameter would sometimes not be honoured if the path was used to serve static files
4280-
using ``StaticFilesConfig``.
4486+
using ``StaticFilesConfig``

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ maintainers = [
6060
name = "litestar"
6161
readme = "README.md"
6262
requires-python = ">=3.8,<4.0"
63-
version = "2.7.1"
63+
version = "2.8.0"
6464

6565
[project.urls]
6666
Blog = "https://blog.litestar.dev"

0 commit comments

Comments
 (0)