File tree Expand file tree Collapse file tree 5 files changed +25
-15
lines changed Expand file tree Collapse file tree 5 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,11 @@ def __init__(self, **kwargs):
5656 if hasattr (self , key ):
5757 setattr (self , key , value )
5858
59- assert isinstance (
60- self .schema , GraphQLSchema
61- ), "A Schema is required to be provided to GraphQLView."
59+ if not isinstance (self .schema , GraphQLSchema ):
60+ # maybe the GraphQL schema is wrapped in a Graphene schema
61+ self .schema = getattr (self .schema , "graphql_schema" , None )
62+ if not isinstance (self .schema , GraphQLSchema ):
63+ raise TypeError ("A Schema is required to be provided to GraphQLView." )
6264
6365 def get_root_value (self ):
6466 return self .root_value
Original file line number Diff line number Diff line change @@ -55,9 +55,11 @@ def __init__(self, **kwargs):
5555 if hasattr (self , key ):
5656 setattr (self , key , value )
5757
58- assert isinstance (
59- self .schema , GraphQLSchema
60- ), "A Schema is required to be provided to GraphQLView."
58+ if not isinstance (self .schema , GraphQLSchema ):
59+ # maybe the GraphQL schema is wrapped in a Graphene schema
60+ self .schema = getattr (self .schema , "graphql_schema" , None )
61+ if not isinstance (self .schema , GraphQLSchema ):
62+ raise TypeError ("A Schema is required to be provided to GraphQLView." )
6163
6264 def get_root_value (self ):
6365 return self .root_value
Original file line number Diff line number Diff line change @@ -57,9 +57,11 @@ def __init__(self, **kwargs):
5757 if hasattr (self , key ):
5858 setattr (self , key , value )
5959
60- assert isinstance (
61- self .schema , GraphQLSchema
62- ), "A Schema is required to be provided to GraphQLView."
60+ if not isinstance (self .schema , GraphQLSchema ):
61+ # maybe the GraphQL schema is wrapped in a Graphene schema
62+ self .schema = getattr (self .schema , "graphql_schema" , None )
63+ if not isinstance (self .schema , GraphQLSchema ):
64+ raise TypeError ("A Schema is required to be provided to GraphQLView." )
6365
6466 def get_root_value (self ):
6567 return self .root_value
Original file line number Diff line number Diff line change @@ -58,9 +58,11 @@ def __init__(self, **kwargs):
5858 if hasattr (self , key ):
5959 setattr (self , key , value )
6060
61- assert isinstance (
62- self .schema , GraphQLSchema
63- ), "A Schema is required to be provided to GraphQLView."
61+ if not isinstance (self .schema , GraphQLSchema ):
62+ # maybe the GraphQL schema is wrapped in a Graphene schema
63+ self .schema = getattr (self .schema , "graphql_schema" , None )
64+ if not isinstance (self .schema , GraphQLSchema ):
65+ raise TypeError ("A Schema is required to be provided to GraphQLView." )
6466
6567 def get_root_value (self ):
6668 return self .root_value
Original file line number Diff line number Diff line change @@ -55,9 +55,11 @@ def __init__(self, **kwargs):
5555 if hasattr (self , key ):
5656 setattr (self , key , value )
5757
58- assert isinstance (
59- self .schema , GraphQLSchema
60- ), "A Schema is required to be provided to GraphQLView."
58+ if not isinstance (self .schema , GraphQLSchema ):
59+ # maybe the GraphQL schema is wrapped in a Graphene schema
60+ self .schema = getattr (self .schema , "graphql_schema" , None )
61+ if not isinstance (self .schema , GraphQLSchema ):
62+ raise TypeError ("A Schema is required to be provided to GraphQLView." )
6163
6264 def get_root_value (self ):
6365 return self .root_value
You can’t perform that action at this time.
0 commit comments