ariadne-codegen icon indicating copy to clipboard operation
ariadne-codegen copied to clipboard

Codegen fails when a GQL string contains `'`

Open affanshahid opened this issue 1 year ago • 0 comments

Generating a client against the following valid query (Note: I am running this against Hasura):

mutation addPerson {
  insert_person_one(object: { username: "Foo's bar" }) {
    id
  }
}

Results in the following error:

 File "src/black/parsing.py", line 90, in lib2to3_parse
black.parsing.InvalidInput: Cannot parse: 15:15:             """s bar"}) {\n''    id\n''  }\n''}\n')

It seems codegen replaces the ' with a """ for some reason.

Changing the query to:

mutation addPerson {
  insert_person_one(object: { username: "Foo bar" }) {
    id
  }
}

Works just fine

affanshahid avatar Mar 16 '24 20:03 affanshahid