Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Serializer: Convert internal error to HTTP 400 in Ramsey uuid denormalization from invalid body string (#4200)
* Symfony: Add tests with Symfony Uuid (#4230)
* OpenAPI: Allow to set extensionProperties with YAML schema definition (#4228)
* GraphQL: Fix `FieldsBuilder` not fully unwrapping nested types before deciding if a resolver is needed (#4251)

## 2.6.4

Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Type/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private function getResourceFieldConfiguration(?string $property, ?string $field
return null;
}

$graphqlWrappedType = $graphqlType instanceof WrappingType ? $graphqlType->getWrappedType() : $graphqlType;
$graphqlWrappedType = $graphqlType instanceof WrappingType ? $graphqlType->getWrappedType(true) : $graphqlType;
$isStandardGraphqlType = \in_array($graphqlWrappedType, GraphQLType::getStandardTypes(), true);
if ($isStandardGraphqlType) {
$resourceClass = '';
Expand Down
19 changes: 19 additions & 0 deletions tests/GraphQl/Type/FieldsBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ public function testGetResourceObjectTypeFields(string $resourceClass, ResourceM
$this->typeConverterProphecy->convertType(Argument::type(Type::class), Argument::type('bool'), null, $mutationName, null, '', $resourceClass, $propertyName, 1)->willReturn(GraphQLType::string());
$this->typeConverterProphecy->convertType(Argument::type(Type::class), Argument::type('bool'), null, null, $subscriptionName, '', $resourceClass, $propertyName, 1)->willReturn(GraphQLType::string());
$this->typeConverterProphecy->convertType(Argument::type(Type::class), true, null, $mutationName, null, 'subresourceClass', $propertyName, 1)->willReturn(GraphQLType::string());
$this->typeConverterProphecy->convertType(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)), Argument::type('bool'), $queryName, null, null, '', $resourceClass, $propertyName, 1)->willReturn(GraphQLType::nonNull(GraphQLType::listOf(GraphQLType::nonNull(GraphQLType::string()))));
}
$this->typesContainerProphecy->has('NotRegisteredType')->willReturn(false);
$this->typesContainerProphecy->all()->willReturn([]);
Expand Down Expand Up @@ -592,6 +593,24 @@ public function resourceObjectTypeFieldsProvider(): array
],
],
],
'query with simple non-null string array property' => ['resourceClass', new ResourceMetadata(),
[
'property' => new PropertyMetadata(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)), null, true, false),
],
false, 'item_query', null, null, null,
[
'id' => [
'type' => GraphQLType::nonNull(GraphQLType::id()),
],
'property' => [
'type' => GraphQLType::nonNull(GraphQLType::listOf(GraphQLType::nonNull(GraphQLType::string()))),
'description' => null,
'args' => [],
'resolve' => null,
'deprecationReason' => null,
],
],
],
'mutation non input' => ['resourceClass', new ResourceMetadata(),
[
'property' => new PropertyMetadata(),
Expand Down