|
26 | 26 | use Doctrine\Common\Inflector\Inflector;
|
27 | 27 | use GraphQL\Type\Definition\InputObjectType;
|
28 | 28 | use GraphQL\Type\Definition\InterfaceType;
|
| 29 | +use GraphQL\Type\Definition\NonNull; |
29 | 30 | use GraphQL\Type\Definition\ObjectType;
|
30 | 31 | use GraphQL\Type\Definition\Type as GraphQLType;
|
31 | 32 | use GraphQL\Type\Definition\WrappingType;
|
@@ -99,7 +100,13 @@ public function getSchema(): Schema
|
99 | 100 | 'fields' => $queryFields,
|
100 | 101 | ]),
|
101 | 102 | 'typeLoader' => function ($name) {
|
102 |
| - return $this->graphqlTypes[$name]; |
| 103 | + $type = $this->graphqlTypes[$name]; |
| 104 | + |
| 105 | + if ($type instanceof WrappingType) { |
| 106 | + return $type->getWrappedType(true); |
| 107 | + } |
| 108 | + |
| 109 | + return $type; |
103 | 110 | },
|
104 | 111 | ];
|
105 | 112 |
|
@@ -394,7 +401,7 @@ private function convertType(Type $type, bool $input = false, string $mutationNa
|
394 | 401 | /**
|
395 | 402 | * Gets the object type of the given resource.
|
396 | 403 | *
|
397 |
| - * @return ObjectType|InputObjectType |
| 404 | + * @return ObjectType|NonNull |
398 | 405 | */
|
399 | 406 | private function getResourceObjectType(?string $resourceClass, ResourceMetadata $resourceMetadata, bool $input = false, string $mutationName = null, bool $wrapped = false, int $depth = 0): GraphQLType
|
400 | 407 | {
|
@@ -451,7 +458,7 @@ private function getResourceObjectType(?string $resourceClass, ResourceMetadata
|
451 | 458 | 'interfaces' => $wrapData ? [] : [$this->getNodeInterface()],
|
452 | 459 | ];
|
453 | 460 |
|
454 |
| - return $this->graphqlTypes[$shortName] = $input ? new InputObjectType($configuration) : new ObjectType($configuration); |
| 461 | + return $this->graphqlTypes[$shortName] = $input ? GraphQLType::nonNull(new InputObjectType($configuration)) : new ObjectType($configuration); |
455 | 462 | }
|
456 | 463 |
|
457 | 464 | /**
|
|
0 commit comments