Skip to content

Commit

Permalink
Fix example in docstring of GraphQLUnionType (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Aug 28, 2020
1 parent 9d9b465 commit c013660
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/graphql/type/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,13 @@ class GraphQLUnionType(GraphQLNamedType):
Example::
class PetType(GraphQLUnionType):
name = 'Pet'
types = [DogType, CatType]
def resolve_type(self, value, _type):
if isinstance(value, Dog):
return DogType()
if isinstance(value, Cat):
return CatType()
def resolve_type(obj, _info, _type):
if isinstance(obj, Dog):
return DogType()
if isinstance(obj, Cat):
return CatType()
PetType = GraphQLUnionType('Pet', [DogType, CatType], resolve_type)
"""

resolve_type: Optional[GraphQLTypeResolver]
Expand All @@ -947,10 +945,6 @@ def __init__(
ast_node: Optional[UnionTypeDefinitionNode] = None,
extension_ast_nodes: Optional[Collection[UnionTypeExtensionNode]] = None,
) -> None:
"""
:rtype: object
"""
super().__init__(
name=name,
description=description,
Expand Down

0 comments on commit c013660

Please sign in to comment.