Refactor type defs merging
@@ -8,13 +8,6 @@ from .build_schema import build_schema_from_type_definitions
from .resolvers import add_resolve_functions_to_schema
-def concatenate_type_defs(type_defs: List[str]) -> str:
- resolved_type_defs = []
- for type_def in type_defs:
- resolved_type_defs.append(type_def.strip())
- return "\n\n".join(resolved_type_defs)
-
-
def decompose_maps(resolvers_map):
def flatten(rm):
for key, value in rm.items():
@@ -31,11 +24,15 @@ def merge_resolvers(resolver_list):
return output
+def join_type_defs(type_defs: List[str]) -> str:
+ return "\n\n".join(t.strip() for t in type_defs)
+
+
def make_executable_schema(
type_defs: Union[str, List[str]], resolvers: Union[dict, List[dict]]
) -> GraphQLSchema:
if isinstance(type_defs, list):
- type_defs = concatenate_type_defs(type_defs)
+ type_defs = join_type_defs(type_defs)
schema = build_schema_from_type_definitions(type_defs)
