mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-12-02 22:43:46 +03:00
af8888f58e
* Use Python 3.10 for deployments on PyPi * Update gh-action-pypi-publish version * Update python version * Update checkout and setup-python versions * Upgrade dev dependencies * fromat examples and few files to follow black new version * Upgrade pytest version --------- Co-authored-by: Firas Kafri <firaskafri@Firass-MacBook-Pro-2.local>
32 lines
812 B
Python
32 lines
812 B
Python
import graphene
|
|
from graphene import ObjectType, Schema
|
|
|
|
from .mutations import PetFormMutation, PetMutation
|
|
|
|
|
|
class QueryRoot(ObjectType):
|
|
thrower = graphene.String(required=True)
|
|
request = graphene.String(required=True)
|
|
test = graphene.String(who=graphene.String())
|
|
|
|
def resolve_thrower(self, info):
|
|
raise Exception("Throws!")
|
|
|
|
def resolve_request(self, info):
|
|
return info.context.GET.get("q")
|
|
|
|
def resolve_test(self, info, who=None):
|
|
return "Hello %s" % (who or "World")
|
|
|
|
|
|
class MutationRoot(ObjectType):
|
|
pet_form_mutation = PetFormMutation.Field()
|
|
pet_mutation = PetMutation.Field()
|
|
write_test = graphene.Field(QueryRoot)
|
|
|
|
def resolve_write_test(self, info):
|
|
return QueryRoot()
|
|
|
|
|
|
schema = Schema(query=QueryRoot, mutation=MutationRoot)
|