|
3 | 3 | 2.x Changelog
|
4 | 4 | =============
|
5 | 5 |
|
| 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 | + |
6 | 212 | .. changelog:: 2.7.1
|
7 | 213 | :date: 2024-03-22
|
8 | 214 |
|
|
973 | 1179 | event listeners are now not propagated anymore but handled by the backend and
|
974 | 1180 | logged instead.
|
975 | 1181 |
|
976 |
| - .. change:: Fix OpenAPI schema for pydantic computed fields |
| 1182 | + .. change:: Fix OpenAPI schema for Pydantic computed fields |
977 | 1183 | :type: bugfix
|
978 | 1184 | :pr: 2797
|
979 | 1185 | :issue: 2792
|
980 | 1186 |
|
981 |
| - Add support for including computed fields in schemas generated from pydantic |
| 1187 | + Add support for including computed fields in schemas generated from Pydantic |
982 | 1188 | models.
|
983 | 1189 |
|
984 | 1190 | .. changelog:: 2.4.1
|
|
2511 | 2717 | :pr: 1865
|
2512 | 2718 | :issue: 1860
|
2513 | 2719 |
|
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 |
2515 | 2721 | caused by the renaming of ``regex`` to ``pattern``, which would lead to the
|
2516 | 2722 | :attr:`~litestar.params.KwargDefinition.pattern` not being validated.
|
2517 | 2723 |
|
|
3446 | 3652 | If you rely on SQLAlchemy 1, you can stick to Starlite *1.51* for now. In the future, a SQLAlchemy 1 plugin
|
3447 | 3653 | may be released as a standalone package.
|
3448 | 3654 |
|
3449 |
| - .. change:: Fix inconsistent parsing of unix timestamp between pydantic and cattrs |
| 3655 | + .. change:: Fix inconsistent parsing of unix timestamp between Pydantic and cattrs |
3450 | 3656 | :type: bugfix
|
3451 | 3657 | :pr: 1492
|
3452 | 3658 | :issue: 1491
|
3453 | 3659 |
|
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 |
3455 | 3661 | return a date with the local timezone.
|
3456 | 3662 |
|
3457 | 3663 | This was corrected by forcing dates to UTC when being parsed by attrs.
|
|
4277 | 4483 | :issue: 1149
|
4278 | 4484 |
|
4279 | 4485 | 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`` |
0 commit comments