Provide a way to use both Strawberry and Graphene types in the same schema.
Note: Requires Graphene v3
- Install library
pip install git+https://github.com/jkimbo/strawberry-graphene.git
- Replace the Graphene Schema with the custom schema
import graphene
+from strawberry_graphene import Schema
class Query(graphene.ObjectType):
@@ -8,4 +9,4 @@ class Query(graphene.ObjectType):
return "World"
-schema = graphene.Schema(query=Query)
+schema = Schema(query=Query)
- Start converting your types
import graphene
+import strawberry
-class User(graphene.ObjectType):
- name = graphene.String()
- age = graphene.Int()
+
+@strawberry.type
+class User:
+ name: str
+ age: int