Skip to content

Commit

Permalink
fix(FederatedSchemaPrinter): Skip printing Mutation type on empty (#12)
Browse files Browse the repository at this point in the history
* fix(FederatedSchemaPrinter): Skip printing Mutation type on empty

* fix: Remove specificity

Co-authored-by: Katy Ereira <[email protected]>

Co-authored-by: Katy Ereira <[email protected]>
  • Loading branch information
ldiego08 and maccath authored Aug 17, 2020
1 parent c1c2033 commit c82df7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Utils/FederatedSchemaPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ private static function printScalar(ScalarType $type, array $options): string
*/
private static function printObject(ObjectType $type, array $options): string
{
if (empty($type->getFields())) {
return '';
}

$interfaces = $type->getInterfaces();
$implementedInterfaces = !empty($interfaces)
? ' implements ' .
Expand All @@ -331,7 +335,7 @@ private static function printObject(ObjectType $type, array $options): string
)
: '';

$queryExtends = $type->name === 'Query' ? 'extend ' : '';
$queryExtends = $type->name === 'Query' || $type->name === 'Mutation' ? 'extend ' : '';

return self::printDescription($options, $type) .
sprintf(
Expand Down

0 comments on commit c82df7b

Please sign in to comment.