From bab0752eb70f1f69400f762c0697c1fe4f7df9fa Mon Sep 17 00:00:00 2001 From: Pedro Mantica Date: Wed, 27 Feb 2019 16:55:43 -0500 Subject: [PATCH 1/2] Fixed bug that failed to include certain abstract classes in schema --- graphql_compiler/schema_generation/graphql_schema.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/graphql_compiler/schema_generation/graphql_schema.py b/graphql_compiler/schema_generation/graphql_schema.py index 2c2191353..bbc275371 100644 --- a/graphql_compiler/schema_generation/graphql_schema.py +++ b/graphql_compiler/schema_generation/graphql_schema.py @@ -320,18 +320,21 @@ def get_graphql_schema_from_schema_graph(schema_graph, class_to_field_type_overr for non_graph_cls_name in schema_graph.non_graph_class_names: if non_graph_cls_name in hidden_classes: continue + if not schema_graph.get_element_by_class_name(non_graph_cls_name): + continue cls_subclasses = schema_graph.get_subclass_set(non_graph_cls_name) # No need to add the possible abstract class if it doesn't have subclasses besides itself. if len(cls_subclasses) > 1: all_non_abstract_subclasses_are_vertices = True - # Check if class is abstract and all non-abstract subclasses are vertices. + # Check all non-abstract subclasses are vertices. for subclass_name in cls_subclasses: subclass = schema_graph.get_element_by_class_name(subclass_name) - if not subclass.abstract and not subclass.is_vertex: - all_non_abstract_subclasses_are_vertices = False - break + if subclass_name != non_graph_cls_name: + if not subclass.abstract and not subclass.is_vertex: + all_non_abstract_subclasses_are_vertices = False + break if all_non_abstract_subclasses_are_vertices: # Add abstract class as an interface. From d73da63c27052db3631862047b5f70eff966c8eb Mon Sep 17 00:00:00 2001 From: Pedro Mantica Date: Wed, 27 Feb 2019 17:13:18 -0500 Subject: [PATCH 2/2] Fully fixed bug --- graphql_compiler/schema_generation/graphql_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql_compiler/schema_generation/graphql_schema.py b/graphql_compiler/schema_generation/graphql_schema.py index bbc275371..073dd3143 100644 --- a/graphql_compiler/schema_generation/graphql_schema.py +++ b/graphql_compiler/schema_generation/graphql_schema.py @@ -320,7 +320,7 @@ def get_graphql_schema_from_schema_graph(schema_graph, class_to_field_type_overr for non_graph_cls_name in schema_graph.non_graph_class_names: if non_graph_cls_name in hidden_classes: continue - if not schema_graph.get_element_by_class_name(non_graph_cls_name): + if not schema_graph.get_element_by_class_name(non_graph_cls_name).abstract: continue cls_subclasses = schema_graph.get_subclass_set(non_graph_cls_name)