Makes a field available on an ObjectType in the GraphQL schema. Any type can be mounted as a Field: - Object Type - Scalar Type - Enum - Interface - Union All class attributes of ``graphene.ObjectType`` are implicitly mounted as Field using the below arguments.
| 21 | |
| 22 | |
| 23 | class Field(MountedType): |
| 24 | """ |
| 25 | Makes a field available on an ObjectType in the GraphQL schema. Any type can be mounted as a |
| 26 | Field: |
| 27 | |
| 28 | - Object Type |
| 29 | - Scalar Type |
| 30 | - Enum |
| 31 | - Interface |
| 32 | - Union |
| 33 | |
| 34 | All class attributes of ``graphene.ObjectType`` are implicitly mounted as Field using the below |
| 35 | arguments. |
| 36 | |
| 37 | .. code:: python |
| 38 | |
| 39 | class Person(ObjectType): |
| 40 | first_name = graphene.String(required=True) # implicitly mounted as Field |
| 41 | last_name = graphene.Field(String, description='Surname') # explicitly mounted as Field |
| 42 | |
| 43 | args: |
| 44 | type (class for a graphene.UnmountedType): Must be a class (not an instance) of an |
| 45 | unmounted graphene type (ex. scalar or object) which is used for the type of this |
| 46 | field in the GraphQL schema. You can provide a dotted module import path (string) |
| 47 | to the class instead of the class itself (e.g. to avoid circular import issues). |
| 48 | args (optional, Dict[str, graphene.Argument]): Arguments that can be input to the field. |
| 49 | Prefer to use ``**extra_args``, unless you use an argument name that clashes with one |
| 50 | of the Field arguments presented here (see :ref:`example<ResolverParamGraphQLArguments>`). |
| 51 | resolver (optional, Callable): A function to get the value for a Field from the parent |
| 52 | value object. If not set, the default resolver method for the schema is used. |
| 53 | source (optional, str): attribute name to resolve for this field from the parent value |
| 54 | object. Alternative to resolver (cannot set both source and resolver). |
| 55 | deprecation_reason (optional, str): Setting this value indicates that the field is |
| 56 | depreciated and may provide instruction or reason on how for clients to proceed. |
| 57 | required (optional, bool): indicates this field as not null in the graphql schema. Same behavior as |
| 58 | graphene.NonNull. Default False. |
| 59 | name (optional, str): the name of the GraphQL field (must be unique in a type). Defaults to attribute |
| 60 | name. |
| 61 | description (optional, str): the description of the GraphQL field in the schema. |
| 62 | default_value (optional, Any): Default value to resolve if none set from schema. |
| 63 | **extra_args (optional, Dict[str, Union[graphene.Argument, graphene.UnmountedType]): any |
| 64 | additional arguments to mount on the field. |
| 65 | """ |
| 66 | |
| 67 | def __init__( |
| 68 | self, |
| 69 | type_, |
| 70 | args=None, |
| 71 | resolver=None, |
| 72 | source=None, |
| 73 | deprecation_reason=None, |
| 74 | name=None, |
| 75 | description=None, |
| 76 | required=False, |
| 77 | _creation_counter=None, |
| 78 | default_value=None, |
| 79 | **extra_args, |
| 80 | ): |
no outgoing calls
searching dependent graphs…