From ee2c43a4302ca2732a2ba7c56434ebbb77f05eb4 Mon Sep 17 00:00:00 2001 From: "Tjeerd.Verschragen" Date: Mon, 3 Jul 2023 13:07:14 +0200 Subject: [PATCH] Add release file --- RELEASE.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000000..853d3b19b6 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,28 @@ +Release type: patch + +Enhancements: +- Improved pydantic conversion compatibility with specialized list classes. + - Modified `StrawberryAnnotation._is_list` to check if the `annotation` extends from the `list` type, enabling it to be considered a list. + - in `StrawberryAnnotation` Moved the `_is_list` check before the `_is_generic` check in `resolve` to avoid `unsupported` error in `_is_generic` before it checked `_is_list`. + +This enhancement enables the usage of constrained lists as class types and allows the creation of specialized lists. The following example demonstrates this feature: + +```python +import strawberry +from pydantic import BaseModel, ConstrainedList + + +class FriendList(ConstrainedList): + min_items = 1 + + +class UserModel(BaseModel): + age: int + friend_names: FriendList[str] + + +@strawberry.experimental.pydantic.type(UserModel) +class User: + age: strawberry.auto + friend_names: strawberry.auto +```