gql.dsl¶
-
gql.dsl.ast_from_serialized_value_untyped(serialized: Any) → Optional[graphql.language.ast.ValueNode]¶ Given a serialized value, try our best to produce an AST.
Anything ressembling an array (instance of Mapping) will be converted to an ObjectFieldNode.
Anything ressembling a list (instance of Iterable - except str) will be converted to a ListNode.
In some cases, a custom scalar can be serialized differently in the query than in the variables. In that case, this function will not work.
-
gql.dsl.ast_from_value(value: Any, type_: Union[graphql.type.definition.GraphQLScalarType, graphql.type.definition.GraphQLEnumType, graphql.type.definition.GraphQLInputObjectType, graphql.type.definition.GraphQLWrappingType]) → Optional[graphql.language.ast.ValueNode]¶ This is a partial copy paste of the ast_from_value function in graphql-core utilities/ast_from_value.py
Overwrite the if blocks that use recursion and add a new case to return a VariableNode when value is a DSLVariable
Produce a GraphQL Value AST given a Python object.
Raises a GraphQLError instead of returning None if we receive an Undefined of if we receive a Null value for a Non-Null type.
-
gql.dsl.dsl_gql(*operations: gql.dsl.DSLExecutable, **operations_with_name: gql.dsl.DSLExecutable) → graphql.language.ast.DocumentNode¶ Given arguments instances of
DSLExecutablecontaining GraphQL operations or fragments, generate a Document which can be executed later in a gql client or a gql session.Similar to the
gql.gql()function but instead of parsing a python string to describe the request, we are using operations which have been generated dynamically using instances ofDSLField, generated by instances ofDSLTypewhich themselves originated from aDSLSchemaclass.- Parameters
*operations (DSLQuery, DSLMutation, DSLSubscription, DSLFragment) – the GraphQL operations and fragments
**operations_with_name (DSLQuery, DSLMutation, DSLSubscription) – the GraphQL operations with an operation name
- Returns
a Document which can be later executed or subscribed by a
Client, by anasync sessionor by async session- Raises
TypeError – if an argument is not an instance of
DSLExecutableAttributeError – if a type has not been provided in a
DSLFragment
-
class
gql.dsl.DSLSchema(schema: graphql.type.schema.GraphQLSchema)¶ Bases:
objectThe DSLSchema is the root of the DSL code.
Attributes of the DSLSchema class are generated automatically with the __getattr__ dunder method in order to generate instances of
DSLType-
__init__(schema: graphql.type.schema.GraphQLSchema)¶ Initialize the DSLSchema with the given schema.
- Parameters
schema (GraphQLSchema) – a GraphQL Schema provided locally or fetched using an introspection query. Usually client.schema
- Raises
TypeError – if the argument is not an instance of
GraphQLSchema
-
-
class
gql.dsl.DSLSelector(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
abc.ABCDSLSelector is an abstract class which defines the
selectmethod to select children fields in the query.Inherited by
DSLRootFieldSelector,DSLFieldSelectorDSLFragmentSelector-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
abstract
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
-
class
gql.dsl.DSLExecutable(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLSelectorInterface for the root elements which can be executed in the
dsl_gqlfunctionInherited by
DSLOperationandDSLFragment-
selection_set: graphql.language.ast.SelectionSetNode¶
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Given arguments of type
DSLSelectablecontaining GraphQL requests, generate an operation which can be converted to a Document using thedsl_gql.The fields arguments should be either be fragments or fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
- Parameters
*fields (DSLSelectable) – root fields or fragments
**fields_with_alias (DSLSelectable) – root fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableAssertionError – if an argument is not a field which correspond to the operation type
-
name: Optional[str]¶
-
variable_definitions: gql.dsl.DSLVariableDefinitions¶
-
abstract
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
-
class
gql.dsl.DSLRootFieldSelector(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLSelectorClass used to define the
is_valid_fieldmethod for root fields for theselectmethod.Inherited by
DSLOperation-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid for a root field.
For operations, the fields arguments should be fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
the
__typenamefield can only be added to Query or Mutation. the__schemaand__typefield can only be added to Query.
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLOperation(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLExecutable,gql.dsl.DSLRootFieldSelectorInterface for GraphQL operations.
Inherited by
DSLQuery,DSLMutationandDSLSubscription-
operation_type: graphql.language.ast.OperationType¶
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Given arguments of type
DSLSelectablecontaining GraphQL requests, generate an operation which can be converted to a Document using thedsl_gql.The fields arguments should be either be fragments or fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
- Parameters
*fields (DSLSelectable) – root fields or fragments
**fields_with_alias (DSLSelectable) – root fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableAssertionError – if an argument is not a field which correspond to the operation type
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid for a root field.
For operations, the fields arguments should be fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
the
__typenamefield can only be added to Query or Mutation. the__schemaand__typefield can only be added to Query.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
variable_definitions: gql.dsl.DSLVariableDefinitions¶
-
name: Optional[str]¶
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLQuery(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLOperation-
operation_type: graphql.language.ast.OperationType = 'query'¶
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Given arguments of type
DSLSelectablecontaining GraphQL requests, generate an operation which can be converted to a Document using thedsl_gql.The fields arguments should be either be fragments or fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
- Parameters
*fields (DSLSelectable) – root fields or fragments
**fields_with_alias (DSLSelectable) – root fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableAssertionError – if an argument is not a field which correspond to the operation type
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid for a root field.
For operations, the fields arguments should be fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
the
__typenamefield can only be added to Query or Mutation. the__schemaand__typefield can only be added to Query.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
variable_definitions: gql.dsl.DSLVariableDefinitions¶
-
name: Optional[str]¶
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLMutation(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLOperation-
operation_type: graphql.language.ast.OperationType = 'mutation'¶
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Given arguments of type
DSLSelectablecontaining GraphQL requests, generate an operation which can be converted to a Document using thedsl_gql.The fields arguments should be either be fragments or fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
- Parameters
*fields (DSLSelectable) – root fields or fragments
**fields_with_alias (DSLSelectable) – root fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableAssertionError – if an argument is not a field which correspond to the operation type
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid for a root field.
For operations, the fields arguments should be fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
the
__typenamefield can only be added to Query or Mutation. the__schemaand__typefield can only be added to Query.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
variable_definitions: gql.dsl.DSLVariableDefinitions¶
-
name: Optional[str]¶
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLSubscription(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLOperation-
operation_type: graphql.language.ast.OperationType = 'subscription'¶
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Given arguments of type
DSLSelectablecontaining GraphQL requests, generate an operation which can be converted to a Document using thedsl_gql.The fields arguments should be either be fragments or fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
- Parameters
*fields (DSLSelectable) – root fields or fragments
**fields_with_alias (DSLSelectable) – root fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableAssertionError – if an argument is not a field which correspond to the operation type
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid for a root field.
For operations, the fields arguments should be fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation.
the
__typenamefield can only be added to Query or Mutation. the__schemaand__typefield can only be added to Query.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
variable_definitions: gql.dsl.DSLVariableDefinitions¶
-
name: Optional[str]¶
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLVariable(name: str)¶ Bases:
objectThe DSLVariable represents a single variable defined in a GraphQL operation
Instances of this class are generated for you automatically as attributes of the
DSLVariableDefinitionsThe type of the variable is set by the
DSLFieldinstance that receives it in theargsmethod.-
__init__(name: str)¶
-
to_ast_type(type_: Union[graphql.type.definition.GraphQLWrappingType, graphql.type.definition.GraphQLNamedType]) → graphql.language.ast.TypeNode¶
-
set_type(type_: Union[graphql.type.definition.GraphQLWrappingType, graphql.type.definition.GraphQLNamedType]) → gql.dsl.DSLVariable¶
-
-
class
gql.dsl.DSLVariableDefinitions¶ Bases:
objectThe DSLVariableDefinitions represents variable definitions in a GraphQL operation
Instances of this class have to be created and set as the variable_definitions attribute of a DSLOperation instance
Attributes of the DSLVariableDefinitions class are generated automatically with the __getattr__ dunder method in order to generate instances of
DSLVariable, that can then be used as values in theargsmethod.-
__init__()¶
-
-
class
gql.dsl.DSLType(graphql_type: Union[graphql.type.definition.GraphQLObjectType, graphql.type.definition.GraphQLInterfaceType], dsl_schema: gql.dsl.DSLSchema)¶ Bases:
objectThe DSLType represents a GraphQL type for the DSL code.
It can be a root type (Query, Mutation or Subscription). Or it can be any other object type (Human in the StarWars schema). Or it can be an interface type (Character in the StarWars schema).
Instances of this class are generated for you automatically as attributes of the
DSLSchemaAttributes of the DSLType class are generated automatically with the __getattr__ dunder method in order to generate instances of
DSLField-
__init__(graphql_type: Union[graphql.type.definition.GraphQLObjectType, graphql.type.definition.GraphQLInterfaceType], dsl_schema: gql.dsl.DSLSchema)¶ Initialize the DSLType with the GraphQL type.
Warning
Don’t instantiate this class yourself. Use attributes of the
DSLSchemainstead.- Parameters
graphql_type – the GraphQL type definition from the schema
dsl_schema – reference to the DSLSchema which created this type
-
-
class
gql.dsl.DSLSelectable¶ Bases:
abc.ABCDSLSelectable is an abstract class which indicates that the subclasses can be used as arguments of the
selectmethod.Inherited by
DSLField,DSLFragmentDSLInlineFragment-
ast_field: Union[graphql.language.ast.FieldNode, graphql.language.ast.InlineFragmentNode, graphql.language.ast.FragmentSpreadNode]¶
-
-
class
gql.dsl.DSLFragmentSelector(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLSelectorClass used to define the
is_valid_fieldmethod for fragments for theselectmethod.Inherited by
DSLFragment,DSLInlineFragment-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid.
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLFieldSelector(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLSelectorClass used to define the
is_valid_fieldmethod for fields for theselectmethod.Inherited by
DSLField,-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid.
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Select the fields which should be added.
- Parameters
*fields (DSLSelectable) – fields or fragments
**fields_with_alias (DSLSelectable) – fields or fragments with alias as key
- Raises
TypeError – if an argument is not an instance of
DSLSelectableGraphQLError – if an argument is not a valid field
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLSelectableWithAlias¶ Bases:
gql.dsl.DSLSelectableDSLSelectableWithAlias is an abstract class which indicates that the subclasses can be selected with an alias.
-
ast_field: graphql.language.ast.FieldNode¶
-
alias(alias: str) → gql.dsl.DSLSelectableWithAlias¶ Set an alias
Note
You can also pass the alias directly at the
selectmethod.ds.Query.human.select(my_name=ds.Character.name)is equivalent to:ds.Query.human.select(ds.Character.name.alias("my_name"))- Parameters
alias (str) – the alias
- Returns
itself
-
-
class
gql.dsl.DSLField(name: str, parent_type: Union[graphql.type.definition.GraphQLObjectType, graphql.type.definition.GraphQLInterfaceType], field: graphql.type.definition.GraphQLField, dsl_type: Optional[gql.dsl.DSLType] = None)¶ Bases:
gql.dsl.DSLSelectableWithAlias,gql.dsl.DSLFieldSelectorThe DSLField represents a GraphQL field for the DSL code.
Instances of this class are generated for you automatically as attributes of the
DSLTypeIf this field contains children fields, then you need to select which ones you want in the request using the
selectmethod.-
__init__(name: str, parent_type: Union[graphql.type.definition.GraphQLObjectType, graphql.type.definition.GraphQLInterfaceType], field: graphql.type.definition.GraphQLField, dsl_type: Optional[gql.dsl.DSLType] = None)¶ Initialize the DSLField.
Warning
Don’t instantiate this class yourself. Use attributes of the
DSLTypeinstead.- Parameters
name – the name of the field
parent_type – the GraphQL type definition from the schema of the parent type of the field
field – the GraphQL field definition from the schema
dsl_type – reference of the DSLType instance which created this field
-
field: graphql.type.definition.GraphQLField¶
-
ast_field: graphql.language.ast.FieldNode¶
-
args(**kwargs) → gql.dsl.DSLField¶ Set the arguments of a field
The arguments are parsed to be stored in the AST of this field.
Note
You can also call the field directly with your arguments.
ds.Query.human(id=1000)is equivalent to:ds.Query.human.args(id=1000)- Parameters
**kwargs – the arguments (keyword=value)
- Returns
itself
- Raises
KeyError – if any of the provided arguments does not exist for this field.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias) → gql.dsl.DSLField¶ Calling
selectmethod with corrected typing hints
-
alias(alias: str) → gql.dsl.DSLSelectableWithAlias¶ Set an alias
Note
You can also pass the alias directly at the
selectmethod.ds.Query.human.select(my_name=ds.Character.name)is equivalent to:ds.Query.human.select(ds.Character.name.alias("my_name"))- Parameters
alias (str) – the alias
- Returns
itself
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid.
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLMetaField(name: str)¶ Bases:
gql.dsl.DSLFieldDSLMetaField represents a GraphQL meta-field for the DSL code.
meta-fields are reserved field in the GraphQL type system prefixed with “__” two underscores and used for introspection.
-
meta_type= <GraphQLObjectType 'meta_field'>¶
-
__init__(name: str)¶ Initialize the meta-field.
- Parameters
name – the name between __typename, __schema or __type
-
args(**kwargs) → gql.dsl.DSLField¶ Set the arguments of a field
The arguments are parsed to be stored in the AST of this field.
Note
You can also call the field directly with your arguments.
ds.Query.human(id=1000)is equivalent to:ds.Query.human.args(id=1000)- Parameters
**kwargs – the arguments (keyword=value)
- Returns
itself
- Raises
KeyError – if any of the provided arguments does not exist for this field.
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias) → gql.dsl.DSLField¶ Calling
selectmethod with corrected typing hints
-
ast_field: graphql.language.ast.FieldNode¶
-
field: graphql.type.definition.GraphQLField¶
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLInlineFragment(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Bases:
gql.dsl.DSLSelectable,gql.dsl.DSLFragmentSelectorDSLInlineFragment represents an inline fragment for the DSL code.
-
__init__(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias)¶ Initialize the DSLInlineFragment.
- Parameters
*fields (DSLSelectable (DSLField, DSLFragment or DSLInlineFragment)) – new children fields
**fields_with_alias (DSLField) – new children fields with alias as key
-
ast_field: graphql.language.ast.InlineFragmentNode¶
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias) → gql.dsl.DSLInlineFragment¶ Calling
selectmethod with corrected typing hints
-
on(type_condition: gql.dsl.DSLType) → gql.dsl.DSLInlineFragment¶ Provides the GraphQL type of this inline fragment.
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid.
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
-
class
gql.dsl.DSLFragment(name: str)¶ Bases:
gql.dsl.DSLSelectable,gql.dsl.DSLFragmentSelector,gql.dsl.DSLExecutableDSLFragment represents a named GraphQL fragment for the DSL code.
-
is_valid_field(field: gql.dsl.DSLSelectable) → bool¶ Check that a field is valid.
-
selection_set: graphql.language.ast.SelectionSetNode¶
-
variable_definitions: gql.dsl.DSLVariableDefinitions¶
-
__init__(name: str)¶ Initialize the DSLFragment.
- Parameters
name (str) – the name of the fragment
-
name: str¶
-
property
ast_field¶ ast_field property will generate a FragmentSpreadNode with the provided name.
Note: We need to ignore the type because of issue #4125 of mypy.
-
select(*fields: gql.dsl.DSLSelectable, **fields_with_alias: gql.dsl.DSLSelectableWithAlias) → gql.dsl.DSLFragment¶ Calling
selectmethod with corrected typing hints
-
on(type_condition: gql.dsl.DSLType) → gql.dsl.DSLFragment¶ Provides the GraphQL type of this fragment.
- Parameters
type_condition (DSLType) – the provided type
-