![]() ![]() Our schema can also define any number of Arguments for our Fields. For more details refer to the Graphene Types Reference. From graphene import ObjectType, String, Schema class Query ( ObjectType ): # this defines a Field `hello` in our Schema with a single Argument `name` hello = String ( name = String ( default_value = "stranger" )) goodbye = String () # our Resolver method takes the GraphQL context (root, info) as well as # Argument (name) for the Field and returns data for the query Response def resolve_hello ( root, info, name ): return f 'Hello !' def resolve_goodbye ( root, info ): return 'See ya!' schema = Schema ( query = Query )Ī GraphQL Schema describes each Field in the data model provided by the server using scalar types like String, Int and Enum and compound types like List and Object.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |