tailcallhq / tailcall

High Performance GraphQL Runtime
https://tailcall.run
Apache License 2.0
1.19k stars 210 forks source link

bug: `@graphql` directive fails to escape strings in nested queries for arguments #2244

Closed amitksingh1490 closed 1 week ago

amitksingh1490 commented 1 week ago

Description

The @graphql directive does not correctly escape string literals in nested queries arguments. This results in invalid JSON strings.

Steps to Reproduce

  1. Define a GraphQL query with a nested filter that includes a string equality condition:
    query {
     queryTest(filter: { a: { eq: "A" } }) {
       id
       name(filter: { eq: "A" })
     }
    }

    Actual

    { "query": "query { getMyType(filter: {a: {eq: \"A\"}}) { id name(filter: {eq: "A"}) } }" }

    Expected

    { "query": "query { getMyType(filter: {a: {eq: \"A\"}}) { id name(filter: {eq: \"A\"}) } }" }