graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

CLI whole query file is inserted in generated query field

Open bonega opened this issue 3 years ago • 1 comments

When generating from a single query-file that contains multiple mutations I get:

pub mod op_a {
   pub const QUERY : & str = "mutation op_a\n mutation op_b\n"
...
}

When sending a graphql request, the response will complain about fields that are present in op_b. If I manually remove op_b from the QUERY field it works.

Thanks for any help.

bonega avatar Aug 24 '22 13:08 bonega

Run into the same issue today. I have 3 separate queries in a query file and the generated code had the same QUERY field ( pub const QUERY : & str = "query LargestSales($limit: Int!, $contract: String!) {\n sales ... ) for all 3 queries. Manually removing the unrelated parts did the job.

kontrol-apa avatar Oct 17 '23 08:10 kontrol-apa