From 75939df2c950a2371858b1eb57ac74daf7930135 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sun, 21 Jun 2026 09:44:35 +0300 Subject: [PATCH] feat: include scalar specifiedBy URL in introspection --- src/Introspector.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Introspector.php b/src/Introspector.php index 6547bfe..de7bcbd 100644 --- a/src/Introspector.php +++ b/src/Introspector.php @@ -9,6 +9,7 @@ use Spawnia\Sailor\Error\ResultErrorsException; use stdClass; +/** @phpstan-import-type IntrospectionOptions from Introspection */ class Introspector { protected EndpointConfig $endpointConfig; @@ -29,9 +30,15 @@ public function introspect(): void $client = $this->endpointConfig->makeClient(); try { - $introspectionResult = $this->fetchIntrospectionResult($client, true); + $introspectionResult = $this->fetchIntrospectionResult($client, [ + 'directiveIsRepeatable' => true, + 'specifiedByURL' => true, + ]); } catch (\Throwable $_) { - $introspectionResult = $this->fetchIntrospectionResult($client, false); + $introspectionResult = $this->fetchIntrospectionResult($client, [ + 'directiveIsRepeatable' => false, + 'specifiedByURL' => false, + ]); } $schema = BuildClientSchema::build( @@ -47,12 +54,11 @@ public function introspect(): void ); } - protected function fetchIntrospectionResult(Client $client, bool $directiveIsRepeatable): Response + /** @param IntrospectionOptions $introspectionQueryOptions */ + protected function fetchIntrospectionResult(Client $client, array $introspectionQueryOptions): Response { $response = $client->request( - Introspection::getIntrospectionQuery([ - 'directiveIsRepeatable' => $directiveIsRepeatable, - ]) + Introspection::getIntrospectionQuery($introspectionQueryOptions) ); if (isset($response->errors)) {