From 0075422c7941cdcbf7d3b1e851fa5d2bda390442 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Sun, 5 Jul 2020 20:43:19 +0200 Subject: [PATCH] build_ast_schema: pass empty schema as literal Replicates graphql/graphql-js@fe4f8ebf58768c42dd3309efa1beeacdb8fc5a9f --- src/graphql/utilities/build_ast_schema.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/graphql/utilities/build_ast_schema.py b/src/graphql/utilities/build_ast_schema.py index a7fde100..6e67e934 100644 --- a/src/graphql/utilities/build_ast_schema.py +++ b/src/graphql/utilities/build_ast_schema.py @@ -49,6 +49,14 @@ def build_ast_schema( assert_valid_sdl(document_ast) + empty_schema_config = GraphQLSchema( + description=None, + types=[], + directives=[], + extensions=None, + extension_ast_nodes=[], + assume_valid=False, + ).to_kwargs() schema_kwargs = extend_schema_impl(empty_schema_config, document_ast, assume_valid) if not schema_kwargs["ast_node"]: @@ -78,9 +86,6 @@ def build_ast_schema( return GraphQLSchema(**schema_kwargs) -empty_schema_config = GraphQLSchema(directives=[]).to_kwargs() - - def build_schema( source: Union[str, Source], assume_valid: bool = False,