syrup icon indicating copy to clipboard operation
syrup copied to clipboard

Fix input objects in OperationVisitor

Open cocoahero opened this issue 3 years ago • 1 comments

While working on another PR, I noticed that Syrup was crashing when trying to parse fields that take an input object as an argument.

For example:

fragment ImageUrl on Image {
  transformedSrc: url(transform: { maxWidth: 1024, maxHeight: 768 })
}
Unterminated argument list starting at line: 3 column: 21 associated with the following input:
 ✓	fragment ImageUrl on Image {
 ✓	__typename
💥	transformedSrc: url(transform: maxWidth: 1024maxHeight: 768)

Notice how the transform: argument is missing the {} and commas between values. I narrowed the bug down to OperationVisitor where valuePrefix and valueSuffix were not being called properly for object fields.

Fixes https://github.com/Shopify/syrup/issues/47

cocoahero avatar Nov 08 '21 13:11 cocoahero

I'm happy to add a test case for this, just don't know how to generate the proper fixtures :)

cocoahero avatar Nov 08 '21 13:11 cocoahero