Skip to content

Commit f0c548d

Browse files
committed
Bring code closer to reference implementation.
1 parent 3ea2c91 commit f0c548d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

graphql/utils/build_ast_schema.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,14 @@ def make_input_object_def(definition):
247247
directives = [get_directive(d) for d in directive_defs]
248248

249249
# If skip and include were not explicitly declared, add them.
250-
filter_directives = (directive.name for directive in directives if directive.name == 'skip' or
251-
directive.name == 'include')
252-
possible_default_directives = ''.join((next(filter_directives, ''), next(filter_directives, '')))
253-
default_directives = {
254-
'skip': [GraphQLIncludeDirective],
255-
'include': [GraphQLSkipDirective],
256-
'': [GraphQLIncludeDirective, GraphQLSkipDirective]
257-
}
258-
directives.extend(default_directives.get(possible_default_directives, []))
250+
find_skip_directive = (directive.name for directive in directives if directive.name == 'skip')
251+
find_include_directive = (directive.name for directive in directives if directive.name == 'include')
252+
253+
if not next(find_skip_directive, None):
254+
directives.append(GraphQLSkipDirective)
255+
256+
if not next(find_include_directive, None):
257+
directives.append(GraphQLIncludeDirective)
259258

260259
schema_kwargs = {'query': get_object_type(ast_map[query_type_name])}
261260

0 commit comments

Comments
 (0)