Skip to content

Commit

Permalink
Merge d73da63 into 7042c3b
Browse files Browse the repository at this point in the history
  • Loading branch information
pmantica1 committed Feb 27, 2019
2 parents 7042c3b + d73da63 commit 59c8c13
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions graphql_compiler/schema_generation/graphql_schema.py
Expand Up @@ -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).abstract:
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.
Expand Down

0 comments on commit 59c8c13

Please sign in to comment.