File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ protected function p(?Node $node): string
414
414
return BlockString::print ($ node ->value );
415
415
}
416
416
417
- return json_encode ($ node ->value , JSON_THROW_ON_ERROR );
417
+ return json_encode ($ node ->value , JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES );
418
418
419
419
case $ node instanceof UnionTypeDefinitionNode:
420
420
$ typesStr = $ this ->printList ($ node ->types , ' | ' );
Original file line number Diff line number Diff line change @@ -291,4 +291,28 @@ public function testPrintPrimitives(): void
291
291
self ::assertASTMatches ('3 ' , AST ::astFromValue (3 , Type::int ()));
292
292
self ::assertASTMatches ('3.14 ' , AST ::astFromValue (3.14 , Type::float ()));
293
293
}
294
+
295
+ public function testDoNotEscapeForwardSlash (): void
296
+ {
297
+ $ ast = Parser::parse (<<<'GRAPHQL'
298
+ query {
299
+ search(query: "repo: webonyx/graphql-php") {
300
+ id
301
+ }
302
+ }
303
+ GRAPHQL
304
+ );
305
+
306
+ self ::assertSame (
307
+ <<<'GRAPHQL'
308
+ {
309
+ search(query: "repo: webonyx/graphql-php") {
310
+ id
311
+ }
312
+ }
313
+
314
+ GRAPHQL,
315
+ Printer::doPrint ($ ast ),
316
+ );
317
+ }
294
318
}
You can’t perform that action at this time.
0 commit comments