Overview
Strawberry GraphQL 0.200, released on September 1, 2023, migrates to Pydantic v2 and improves integrations.
Main Features
Pydantic v2 support
Strawberry types can be created from Pydantic v2 models, benefiting from faster validation.
python
import strawberry
from pydantic import BaseModel
class UserModel(BaseModel):
name: str
age: int
@strawberry.experimental.pydantic.type(model=UserModel)
class User:
name: strawberry.auto
age: strawberry.auto
Improved integrations
Django, FastAPI, and Flask integrations are updated for better performance.
python
import strawberry
from strawberry.fastapi import GraphQLRouter
@strawberry.type
class Query:
@strawberry.field
def hello(self, name: str = 'World') -> str:
return f'Hello {name}'
schema = strawberry.Schema(query=Query)
router = GraphQLRouter(schema)
