Duplication identifier issue with codegen
See original GitHub issueDescribe the bug
I have a a query and a mutation inside ./src/graphql/queries
.
I’m generating to the folder ./src/graphql/generated/
.
Somehow the codegen is generating all the typings twice, resulting in a lot of duplicate identifiers. My codegen config is below:
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
debug: true,
schema: "http://192.168.1.251:5050/api",
documents: "src/graphql/queries/*.ts",
ignoreNoDocuments: true,
config: {
withHooks: true,
namingConvention: {
enumValues: "keep",
},
},
generates: {
"./src/graphql/generated/": {
preset: "client",
config: {
addUnderscoreToArgsType: true,
},
plugins: ["typescript", "typescript-operations", "typescript-urql"],
},
"./graphql.schema.json": {
plugins: ["introspection"],
},
},
};
export default config;
Your Example Website or App
Not published
Steps to Reproduce the Bug or Issue
Have a query and a mutation in a folder, and run codegen on it. The types are generated TWICE in the same output file.
Expected behavior
The types should only be generated once for the schema.
Screenshots or Videos
No response
Platform
- OS: Windows 10
- NodeJS: v18.9.0
graphql
version: ^16.6.0@graphql-codegen/*
version(s): 2.13.5
Codegen Config File
No response
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:17
Top Results From Across the Web
1.9.1 Duplicate identifiers when using typescirpt plugin #3046
Describe the bug. I just added a typescript plugin and start getting duplicate identifier errors all over the place.
Read more >GraphQL Codegen duplicates RegisterDocument with ...
I'm Charly, from The Guild, working on GraphQL Code Generator. The preset: "client" is not meant to be used in combination with other ......
Read more >Typescript codegen from graphql schema has types issues
Typescript codegen from graphql schema has types issues ... custom naming function - Duplicate identifier on Typescript type generation due ...
Read more >typescript-react-query - GraphQL Code Generator
This plugin generates React-Query Hooks with TypeScript typings. It extends the basic TypeScript plugins: @graphql-codegen/typescript , @graphql ...
Read more >lib/CodeGen/TailDuplication.cpp Source File - LLVM
1 //===- TailDuplication.cpp - Duplicate blocks into predecessors' tails ----===// ... 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bfourgeaud Not much to be found in the documentation but from what I gather, the client preset is just like a collection of plugins to get you up and running fast. If you are specifying the plugins you want to use with their own individual options yourself, you are better off removing the client preset since it would be like specifying certain plugins twice (once from the preset and one more individually), which could explain the duplicates in the generation. I could be wrong, though.
I see. Thank you for your response!