@@ -69,13 +69,13 @@ public function __invoke(Request $request): Response
69
69
}
70
70
}
71
71
72
- [$ query , $ operation , $ variables ] = $ this ->parseRequest ($ request );
72
+ [$ query , $ operationName , $ variables ] = $ this ->parseRequest ($ request );
73
73
if (null === $ query ) {
74
74
throw new BadRequestHttpException ('GraphQL query is not valid. ' );
75
75
}
76
76
77
77
$ executionResult = $ this ->executor
78
- ->executeQuery ($ this ->schemaBuilder ->getSchema (), $ query , null , null , $ variables , $ operation )
78
+ ->executeQuery ($ this ->schemaBuilder ->getSchema (), $ query , null , null , $ variables , $ operationName )
79
79
->setErrorFormatter ([$ this ->normalizer , 'normalize ' ]);
80
80
} catch (\Exception $ exception ) {
81
81
$ executionResult = (new ExecutionResult (null , [new Error ($ exception ->getMessage (), null , null , null , null , $ exception )]))
@@ -91,34 +91,34 @@ public function __invoke(Request $request): Response
91
91
private function parseRequest (Request $ request ): array
92
92
{
93
93
$ query = $ request ->query ->get ('query ' );
94
- $ operation = $ request ->query ->get ('operationName ' );
94
+ $ operationName = $ request ->query ->get ('operationName ' );
95
95
if ($ variables = $ request ->query ->get ('variables ' , [])) {
96
96
$ variables = $ this ->decodeVariables ($ variables );
97
97
}
98
98
99
99
if (!$ request ->isMethod ('POST ' )) {
100
- return [$ query , $ operation , $ variables ];
100
+ return [$ query , $ operationName , $ variables ];
101
101
}
102
102
103
103
if ('json ' === $ request ->getContentType ()) {
104
- return $ this ->parseData ($ query , $ operation , $ variables , $ request ->getContent ());
104
+ return $ this ->parseData ($ query , $ operationName , $ variables , $ request ->getContent ());
105
105
}
106
106
107
107
if ('graphql ' === $ request ->getContentType ()) {
108
108
$ query = $ request ->getContent ();
109
109
}
110
110
111
111
if ('multipart ' === $ request ->getContentType ()) {
112
- return $ this ->parseMultipartRequest ($ query , $ operation , $ variables , $ request ->request ->all (), $ request ->files ->all ());
112
+ return $ this ->parseMultipartRequest ($ query , $ operationName , $ variables , $ request ->request ->all (), $ request ->files ->all ());
113
113
}
114
114
115
- return [$ query , $ operation , $ variables ];
115
+ return [$ query , $ operationName , $ variables ];
116
116
}
117
117
118
118
/**
119
119
* @throws BadRequestHttpException
120
120
*/
121
- private function parseData (?string $ query , ?string $ operation , array $ variables , string $ jsonContent ): array
121
+ private function parseData (?string $ query , ?string $ operationName , array $ variables , string $ jsonContent ): array
122
122
{
123
123
if (!\is_array ($ data = json_decode ($ jsonContent , true ))) {
124
124
throw new BadRequestHttpException ('GraphQL data is not valid JSON. ' );
@@ -133,23 +133,23 @@ private function parseData(?string $query, ?string $operation, array $variables,
133
133
}
134
134
135
135
if (isset ($ data ['operationName ' ])) {
136
- $ operation = $ data ['operationName ' ];
136
+ $ operationName = $ data ['operationName ' ];
137
137
}
138
138
139
- return [$ query , $ operation , $ variables ];
139
+ return [$ query , $ operationName , $ variables ];
140
140
}
141
141
142
142
/**
143
143
* @throws BadRequestHttpException
144
144
*/
145
- private function parseMultipartRequest (?string $ query , ?string $ operation , array $ variables , array $ bodyParameters , array $ files ): array
145
+ private function parseMultipartRequest (?string $ query , ?string $ operationName , array $ variables , array $ bodyParameters , array $ files ): array
146
146
{
147
147
if ((null === $ operations = $ bodyParameters ['operations ' ] ?? null ) || (null === $ map = $ bodyParameters ['map ' ] ?? null )) {
148
148
throw new BadRequestHttpException ('GraphQL multipart request does not respect the specification. ' );
149
149
}
150
150
151
151
/** @var string $operations */
152
- [$ query , $ operation , $ variables ] = $ this ->parseData ($ query , $ operation , $ variables , $ operations );
152
+ [$ query , $ operationName , $ variables ] = $ this ->parseData ($ query , $ operationName , $ variables , $ operations );
153
153
154
154
/** @var string $map */
155
155
if (!\is_array ($ decodedMap = json_decode ($ map , true ))) {
@@ -158,7 +158,7 @@ private function parseMultipartRequest(?string $query, ?string $operation, array
158
158
159
159
$ variables = $ this ->applyMapToVariables ($ decodedMap , $ variables , $ files );
160
160
161
- return [$ query , $ operation , $ variables ];
161
+ return [$ query , $ operationName , $ variables ];
162
162
}
163
163
164
164
/**
0 commit comments