mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-25 11:03:58 +03:00
commit
80066e55f3
|
@ -1,7 +1,7 @@
|
||||||
Enums
|
Enums
|
||||||
=====
|
=====
|
||||||
|
|
||||||
A ``Enum`` is a special ``GraphQL`` type that represents a set of
|
An ``Enum`` is a special ``GraphQL`` type that represents a set of
|
||||||
symbolic names (members) bound to unique, constant values.
|
symbolic names (members) bound to unique, constant values.
|
||||||
|
|
||||||
Definition
|
Definition
|
||||||
|
|
|
@ -91,7 +91,7 @@ For example, you can define a field ``hero`` that resolves to any
|
||||||
schema = graphene.Schema(query=Query, types=[Human, Droid])
|
schema = graphene.Schema(query=Query, types=[Human, Droid])
|
||||||
|
|
||||||
This allows you to directly query for fields that exist on the Character interface
|
This allows you to directly query for fields that exist on the Character interface
|
||||||
as well as selecting specific fields on any type that implments the interface
|
as well as selecting specific fields on any type that implements the interface
|
||||||
using `inline fragments <https://graphql.org/learn/queries/#inline-fragments>`_.
|
using `inline fragments <https://graphql.org/learn/queries/#inline-fragments>`_.
|
||||||
|
|
||||||
For example, the following query:
|
For example, the following query:
|
||||||
|
|
|
@ -46,13 +46,13 @@ The above ``Person`` ObjectType has the following schema representation:
|
||||||
Resolvers
|
Resolvers
|
||||||
---------
|
---------
|
||||||
|
|
||||||
A resolver is a method that resolves certain fields within a
|
A resolver is a method that resolves certain fields within an
|
||||||
``ObjectType``. If not specified otherwise, the resolver of a
|
``ObjectType``. If not specified otherwise, the resolver of a
|
||||||
field is the ``resolve_{field_name}`` method on the ``ObjectType``.
|
field is the ``resolve_{field_name}`` method on the ``ObjectType``.
|
||||||
|
|
||||||
By default resolvers take the arguments ``info`` and ``*args``.
|
By default resolvers take the arguments ``info`` and ``*args``.
|
||||||
|
|
||||||
NOTE: The resolvers on a ``ObjectType`` are always treated as ``staticmethod``\ s,
|
NOTE: The resolvers on an ``ObjectType`` are always treated as ``staticmethod``\ s,
|
||||||
so the first argument to the resolver method ``self`` (or ``root``) need
|
so the first argument to the resolver method ``self`` (or ``root``) need
|
||||||
not be an actual instance of the ``ObjectType``.
|
not be an actual instance of the ``ObjectType``.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user