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 src/Type/Introspection.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static function getIntrospectionQuery(array $options = []): string
kind
name
{$descriptions}
isOneOf
fields(includeDeprecated: true) {
name
{$descriptions}
Expand Down
37 changes: 37 additions & 0 deletions tests/Type/IntrospectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => 'SomeObject',
'isOneOf' => null,
'fields' => [
[
'name' => 'someField',
Expand All @@ -74,6 +75,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'SCALAR',
'name' => 'String',
'isOneOf' => null,
'fields' => null,
'inputFields' => null,
'interfaces' => null,
Expand All @@ -83,6 +85,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'SCALAR',
'name' => 'Boolean',
'isOneOf' => null,
'fields' => null,
'inputFields' => null,
'interfaces' => null,
Expand All @@ -92,6 +95,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => '__Schema',
'isOneOf' => null,
'fields' => [
0 => [
'name' => 'types',
Expand Down Expand Up @@ -185,6 +189,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => '__Type',
'isOneOf' => null,
'fields' => [
0 => [
'name' => 'kind',
Expand Down Expand Up @@ -385,6 +390,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'ENUM',
'name' => '__TypeKind',
'isOneOf' => null,
'fields' => null,
'inputFields' => null,
'interfaces' => null,
Expand Down Expand Up @@ -435,6 +441,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => '__Field',
'isOneOf' => null,
'fields' => [
0 => [
'name' => 'name',
Expand Down Expand Up @@ -547,6 +554,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => '__InputValue',
'isOneOf' => null,
'fields' => [
0 => [
'name' => 'name',
Expand Down Expand Up @@ -635,6 +643,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => '__EnumValue',
'isOneOf' => null,
'fields' => [
0 => [
'name' => 'name',
Expand Down Expand Up @@ -697,6 +706,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'OBJECT',
'name' => '__Directive',
'isOneOf' => null,
'fields' => [
[
'name' => 'name',
Expand Down Expand Up @@ -794,6 +804,7 @@ public function testExecutesAnIntrospectionQuery(): void
[
'kind' => 'ENUM',
'name' => '__DirectiveLocation',
'isOneOf' => null,
'fields' => null,
'inputFields' => null,
'interfaces' => null,
Expand Down Expand Up @@ -1831,4 +1842,30 @@ public static function invisibleFieldDataProvider(): iterable
yield [fn (): bool => false];
yield [false];
}

public function testIsOneOf(): void
{
$input = new InputObjectType([
'name' => 'SearchInput',
'isOneOf' => true,
'fields' => [
'name' => ['type' => Type::string()],
'email' => ['type' => Type::string()],
],
]);

$query = new ObjectType([
'name' => 'QueryRoot',
'fields' => [
'input' => ['type' => $input],
],
]);

$schema = new Schema([
'query' => $query,
]);

$introspection = Introspection::fromSchema($schema);
self::assertTrue($introspection['__schema']['types'][1]['isOneOf']);
}
}
2 changes: 1 addition & 1 deletion tests/Validator/QueryComplexityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function testQueryWithCustomAndSkipDirective(): void

public function testComplexityIntrospectionQuery(): void
{
$this->assertIntrospectionQuery(187);
$this->assertIntrospectionQuery(188);
}

public function testIntrospectionTypeMetaFieldQuery(): void
Expand Down
Loading