File tree Expand file tree Collapse file tree 4 files changed +41
-12
lines changed
app/code/Magento/GraphQl/Controller
lib/internal/Magento/Framework/GraphQl/Type/Definition Expand file tree Collapse file tree 4 files changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -211,12 +211,6 @@ public function dispatch(RequestInterface $request): ResponseInterface
211211 private function overrideStandardGraphQLTypes (): void
212212 {
213213 $ standardTypes = GraphQLType::getStandardTypes ();
214- // $intConfig = [
215- // 'name' => $standardInt->name,
216- // 'description' => $standardInt->description,
217- // 'astNode' => $standardInt->astNode,
218- // 'extensionASTNodes' => $standardInt->extensionASTNodes
219- // ];
220214
221215 $ intType = new IntType ($ standardTypes [GraphQLType::INT ]->config );
222216 $ floatType = new FloatType ($ standardTypes [GraphQLType::FLOAT ]->config );
Original file line number Diff line number Diff line change 99
1010use Exception ;
1111use GraphQL \Error \Error as GraphQLError ;
12+ use GraphQL \Language \AST \FloatValueNode ;
13+ use GraphQL \Language \AST \IntValueNode ;
1214use GraphQL \Language \AST \Node ;
15+ use GraphQL \Language \AST \ValueNode ;
1316
1417/**
1518 * Replacement for the FloatType definition that can typecast non-numeric values for backwards compatibility
@@ -42,9 +45,19 @@ public function parseValue($value): float
4245 public function parseLiteral (Node $ valueNode , ?array $ variables = null ): float
4346 {
4447 try {
45- return $ this ->parseValue ($ valueNode ->value );
48+ if (
49+ $ valueNode instanceof ValueNode
50+ && !($ valueNode instanceof FloatValueNode)
51+ && !($ valueNode instanceof IntValueNode)
52+ && isset ($ valueNode ->value )
53+ ) {
54+ $ valueNode = new FloatValueNode ([
55+ 'value ' => (string )$ this ->parseValue ($ valueNode ->value ),
56+ 'loc ' => $ valueNode ->loc
57+ ]);
58+ }
4659 } catch (Exception $ e ) {
4760 }
48- return parent ::parseLiteral ($ valueNode );
61+ return parent ::parseLiteral ($ valueNode, $ variables );
4962 }
5063}
Original file line number Diff line number Diff line change 99
1010use Exception ;
1111use GraphQL \Error \Error as GraphQLError ;
12+ use GraphQL \Language \AST \IntValueNode ;
1213use GraphQL \Language \AST \Node ;
14+ use GraphQL \Language \AST \ValueNode ;
1315
1416/**
1517 * Replacement for the IntType definition that can typecast non-numeric values for backwards compatibility
@@ -42,9 +44,18 @@ public function parseValue($value): int
4244 public function parseLiteral (Node $ valueNode , ?array $ variables = null ): int
4345 {
4446 try {
45- return $ this ->parseValue ($ valueNode ->value );
47+ if (
48+ $ valueNode instanceof ValueNode
49+ && !($ valueNode instanceof IntValueNode)
50+ && isset ($ valueNode ->value )
51+ ) {
52+ $ valueNode = new IntValueNode ([
53+ 'value ' => (string )$ this ->parseValue ($ valueNode ->value ),
54+ 'loc ' => $ valueNode ->loc
55+ ]);
56+ }
4657 } catch (Exception $ e ) {
4758 }
48- return parent ::parseLiteral ($ valueNode );
59+ return parent ::parseLiteral ($ valueNode, $ variables );
4960 }
5061}
Original file line number Diff line number Diff line change 1010use Exception ;
1111use GraphQL \Error \Error as GraphQLError ;
1212use GraphQL \Language \AST \Node ;
13+ use GraphQL \Language \AST \StringValueNode ;
14+ use GraphQL \Language \AST \ValueNode ;
1315
1416/**
1517 * Replacement for the StringType definition that can typecast non-string values for backwards compatibility
@@ -42,9 +44,18 @@ public function parseValue($value): string
4244 public function parseLiteral (Node $ valueNode , ?array $ variables = null ): string
4345 {
4446 try {
45- return $ this ->parseValue ($ valueNode ->value );
47+ if (
48+ $ valueNode instanceof ValueNode
49+ && !($ valueNode instanceof StringValueNode)
50+ && isset ($ valueNode ->value )
51+ ) {
52+ $ valueNode = new StringValueNode ([
53+ 'value ' => $ this ->parseValue ($ valueNode ->value ),
54+ 'loc ' => $ valueNode ->loc
55+ ]);
56+ }
4657 } catch (Exception $ e ) {
4758 }
48- return parent ::parseLiteral ($ valueNode );
59+ return parent ::parseLiteral ($ valueNode, $ variables );
4960 }
5061}
You can’t perform that action at this time.
0 commit comments