mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 12:44:15 +03:00
Modify the field example to remove the use of interface
This commit is contained in:
parent
295fba37d1
commit
f3f210b523
|
@ -1,15 +1,12 @@
|
||||||
import graphene
|
import graphene
|
||||||
|
|
||||||
|
|
||||||
class Person(graphene.Interface):
|
class Patron(graphene.ObjectType):
|
||||||
|
id = graphene.ID()
|
||||||
name = graphene.String()
|
name = graphene.String()
|
||||||
age = graphene.ID()
|
age = graphene.ID()
|
||||||
|
|
||||||
|
|
||||||
class Patron(Person):
|
|
||||||
id = graphene.ID()
|
|
||||||
|
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
|
|
||||||
patron = graphene.Field(Patron)
|
patron = graphene.Field(Patron)
|
||||||
|
@ -27,5 +24,4 @@ query = '''
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
result = schema.execute(query)
|
result = schema.execute(query)
|
||||||
# Print the result
|
|
||||||
print(result.data['patron'])
|
print(result.data['patron'])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user