Coverage for docs_src / graphql_ / tutorial001_py310.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1import strawberry 1adbc
2from fastapi import FastAPI 1adbc
3from strawberry.fastapi import GraphQLRouter 1adbc
6@strawberry.type 1adbc
7class User: 1adbc
8 name: str 1abc
9 age: int 1abc
12@strawberry.type 1adbc
13class Query: 1adbc
14 @strawberry.field 1adbc
15 def user(self) -> User: 1adbc
16 return User(name="Patrick", age=100) 1efgh
19schema = strawberry.Schema(query=Query) 1adbc
22graphql_app = GraphQLRouter(schema) 1adbc
24app = FastAPI() 1adbc
25app.include_router(graphql_app, prefix="/graphql") 1adbc