graphql-go-tools icon indicating copy to clipboard operation
graphql-go-tools copied to clipboard

accept queries with comments

Open asoorm opened this issue 4 years ago • 0 comments

It is not possible to parse comments inside queries.

Request Example

curl --location --request POST 'http://localhost:8080/user/' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query SubgraphIntrospectQuery {\n    # eslint-disable-next-line\n    _service {\n        sdl\n    }\n}","variables":{}}'

Actual Response

{
    "errors": [
        {
            "message": "unexpected token - got: COMMENT want one of: [RBRACE IDENT SPREAD]",
            "locations": [
                {
                    "line": 2,
                    "column": 5
                }
            ]
        }
    ]
}

Expected Response

{
    "data": {
        "_service": {
            "sdl": "extend type Query {\n  me: User\n}\n\ntype User @key(fields: \"id\") {\n  id: ID!\n  name: String\n  username: String\n}\n"
        }
    }
}

asoorm avatar Aug 23 '21 14:08 asoorm