Skip to content

Commit 51aad94

Browse files
committed
Allow zero mutations/querys in graph
1 parent 40c1dab commit 51aad94

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/fastcs/backends/graphQL/graphQL.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,19 @@ def get_child(self, name: str) -> "FieldsTree":
139139
return child
140140
raise NodeNotFoundError
141141

142-
def create_type(self, strawberry_type: str) -> type:
142+
def create_type(self, strawberry_type: str) -> type | None:
143143
for child in self.children:
144-
child_field = _wrap_as_field(
145-
child.name,
146-
child.create_type(strawberry_type),
147-
)
148-
self.fields_dict[strawberry_type].append(child_field)
144+
if new_type := child.create_type(strawberry_type):
145+
child_field = _wrap_as_field(
146+
child.name,
147+
new_type,
148+
)
149+
self.fields_dict[strawberry_type].append(child_field)
149150

150-
return create_type(
151-
f"{self.name}{strawberry_type}", self.fields_dict[strawberry_type]
152-
)
151+
if self.fields_dict[strawberry_type]:
152+
return create_type(
153+
f"{self.name}{strawberry_type}", self.fields_dict[strawberry_type]
154+
)
153155

154156

155157
def _add_dev_attributes(

0 commit comments

Comments
 (0)