def returns_true_for_object_interface_and_union_types(): assert is_composite_type(ObjectType) is True assert_composite_type(ObjectType) assert is_composite_type(InterfaceType) is True assert_composite_type(InterfaceType) assert is_composite_type(UnionType) is True assert_composite_type(UnionType)
def enter(*args): parent_type = type_info.get_parent_type() type_ = type_info.get_type() input_type = type_info.get_input_type() node = args[0] visited.append( ( "enter", node.kind, node.value if node.kind == "name" else None, str(parent_type) if parent_type else None, str(type_) if type_ else None, str(input_type) if input_type else None, ) ) # Make a query valid by adding missing selection sets. if ( node.kind == "field" and not node.selection_set and is_composite_type(get_named_type(type_)) ): return FieldNode( alias=node.alias, name=node.name, arguments=node.arguments, directives=node.directives, selection_set=SelectionSetNode( selections=[FieldNode(name=NameNode(value="__typename"))] ), )
def enter(self, node, key, parent, *args): # type: (Any, Union[None, int, str], Any, *List[Any]) -> Optional[Any] parent_type = type_info.get_parent_type() _type = type_info.get_type() input_type = type_info.get_input_type() visited.append( [ "enter", type(node).__name__, node.value if type(node).__name__ == "Name" else None, str(parent_type) if parent_type else None, str(_type) if _type else None, str(input_type) if input_type else None, ] ) # Make a query valid by adding missing selection sets. if ( type(node).__name__ == "Field" and not node.selection_set and is_composite_type(get_named_type(_type)) ): return Field( alias=node.alias, name=node.name, arguments=node.arguments, directives=node.directives, selection_set=SelectionSet([Field(name=Name(value="__typename"))]), )
def enter(self, node, key, parent, *args): parent_type = type_info.get_parent_type() _type = type_info.get_type() input_type = type_info.get_input_type() visited.append([ 'enter', type(node).__name__, node.value if type(node).__name__ == "Name" else None, str(parent_type) if parent_type else None, str(_type) if _type else None, str(input_type) if input_type else None ]) # Make a query valid by adding missing selection sets. if type(node).__name__ == "Field" and not node.selection_set and is_composite_type(get_named_type(_type)): return Field( alias=node.alias, name=node.name, arguments=node.arguments, directives=node.directives, selection_set=SelectionSet( [Field(name=Name(value='__typename'))] ) )
def enter(self, node, key, parent, *args): parent_type = type_info.get_parent_type() _type = type_info.get_type() input_type = type_info.get_input_type() visited.append([ 'enter', type(node).__name__, node.value if type(node).__name__ == "Name" else None, str(parent_type) if parent_type else None, str(_type) if _type else None, str(input_type) if input_type else None ]) # Make a query valid by adding missing selection sets. if type( node ).__name__ == "Field" and not node.selection_set and is_composite_type( get_named_type(_type)): return Field(alias=node.alias, name=node.name, arguments=node.arguments, directives=node.directives, selection_set=SelectionSet( [Field(name=Name(value='__typename'))]))
def returns_false_for_wrapped_non_composite_type(): assert is_composite_type(GraphQLList(InputObjectType)) is False with raises(TypeError): assert_composite_type(GraphQLList(InputObjectType))
def returns_false_for_non_composite_type(): assert is_composite_type(InputObjectType) is False with raises(TypeError): assert_composite_type(InputObjectType)