Skip to content

Commit

Permalink
Keep the @macro_edge_target in the macro descriptor (#197)
Browse files Browse the repository at this point in the history
If we remove the `@macro_edge_target` directive we permanently lose information on where the user code should be pasted inside the macro.
  • Loading branch information
bojanserafimov committed Feb 14, 2019
1 parent d853488 commit 30d5460
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions graphql_compiler/macros/macro_edge/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def get_and_validate_macro_edge_info(schema, ast, macro_edge_args,
# sufficient for the macro, and the macro args' types match the inferred types of the
# runtime parameters in the macro.

# TODO(bojanserafimov): After compiling the macro, read the type at the target from the location
# info in the metadata table, and record it in the macro descriptor.

_validate_class_selection_ast(
get_only_selection_from_ast(ast, GraphQLInvalidMacroError), macro_defn_ast)
class_name = get_ast_field_name(macro_defn_ast)
Expand All @@ -177,6 +180,7 @@ def _make_macro_edge_descriptor(macro_definition_ast, macro_edge_args):
directives_to_remove = {
directive.name
for directive in MACRO_EDGE_DIRECTIVES
if directive.name != MacroEdgeTargetDirective.name
}
new_ast = remove_directives_from_ast(macro_definition_ast, directives_to_remove)

Expand Down

0 comments on commit 30d5460

Please sign in to comment.