Skip to content

Commit c47b056

Browse files
committed
Merge branch '2.3'
2 parents ad05305 + a74b570 commit c47b056

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/GraphQl/Type/SchemaBuilder.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,21 @@ public function getSchema(): Schema
9292
}
9393
}
9494

95-
return new Schema([
95+
$schema = [
9696
'query' => new ObjectType([
9797
'name' => 'Query',
9898
'fields' => $queryFields,
9999
]),
100-
'mutation' => new ObjectType([
100+
];
101+
102+
if ($mutationFields) {
103+
$schema['mutation'] = new ObjectType([
101104
'name' => 'Mutation',
102105
'fields' => $mutationFields,
103-
]),
104-
]);
106+
]);
107+
}
108+
109+
return new Schema($schema);
105110
}
106111

107112
private function getNodeInterface(): InterfaceType

0 commit comments

Comments
 (0)