Tag: graphql-codegen
-
Why does @graphql-codegen/typescript declare the resolver parent type to be an output type?
0 I am using @graphql-codegen/typescript to generate types for this graphql schema: type Book { title: String author: String comment: String } type Query { books: [Book] } Excerpt from the generated code: export type Book = { __typename?: ‘Book’; author?: Maybe<Scalars[‘String’][‘output’]>; comment?: Maybe<Scalars[‘String’][‘output’]>; title?: Maybe<Scalars[‘String’][‘output’]>; }; The TS type "Book" is the type used…
-
Graphql codegen configuration does not load documents with Glob Expression
0 My API is written with TypeScript/Apollo and I am able to run queries/mutations on https://localhost:4000/graphql. My front-end is with Next.js and Apollo client. I use GraphQL Codegenerator to generate the client-side code I need. I am using: "@graphql-codegen/cli": "1.20.1", "@graphql-codegen/typescript": "1.20.2", "@graphql-codegen/typescript-operations": "1.17.14", "@graphql-codegen/typescript-react-apollo": "2.2.1", and my codegen.yml file is overwrite: true schema: "https://localhost:4000/graphql"…
-
Graphql Codegen adds an extra property for my custom scalars
0 I just recently added the typescript-resolvers plugin to my codegen config, and while it does what I need, it seems to also add my custom scalars to the ResolversTypes. The issue is that it seems to add an extra [‘output’] property to these scalars. For example; I end up getting an error: Property ‘output’…
-
@graphql-codegen/typescript-react-query not generating object format for useQuery
-1 I am using @graphql-codegen/typescript-react-query to generate typescript from my graphql schema. these are my @graphql-codegen dependencies "@graphql-codegen/cli": "^5.0.0", "@graphql-codegen/typescript": "^4.0.1", "@graphql-codegen/typescript-operations": "^4.0.1", "@graphql-codegen/typescript-react-query": "^6.0.0", "@graphql-eslint/eslt-plugin": "^3.19.1", my generation configuration is: "schema.ts": { plugins: [ "typescript", "typescript-operations", "typescript-react-query" ], config: { enumValues: enumValues, exposeDocument: true, exposeQueryKeys: true, exposeMutationKeys: true, exposeFetcher: true, addInfiniteQuery: true } }…
-
GraphQL Codegen isn’t generating types from the in-line fragments
-1 I am using Apollo Client 3 and GraphQL Codegen. I have the following query: query Page($path: String!) { page(path: $path) { id content { …on PageOne { id description } …on PageTwo { id title } } } } My codegen config file: // codegen.ts import type { CodegenConfig } from ‘@graphql-codegen/cli’; const config:…
-
Rename types with graphql-codegen
4 I’m working on a legacy codebase where, in our GraphQL schema, an interface was defined as ‘Subscription’: interface Subscription { fieldOne: String fieldTwo: String } type FirstSubscriptionType implements Subscription { anotherField: String } type SecondSubscriptionType implements Subscription { yetAnotherField: String } This has worked fine (we don’t use subscriptions and don’t have plans to),…
-
GraphQL Codegen issue: Unable to load template plugin matching ‘typescript-common’
-1 I am trying to setup GraphQL Code Generator. But I get this error: gql-gen –config codegen.ts ✔ Parse Configuration ⚠ Generate outputs ❯ Generate to src/graphql/generated/schema.ts ✔ Load GraphQL schemas ✔ Load GraphQL documents ✖ Unable to load template plugin matching ‘typescript-common’. Reason: Body must be a string. Received: undefined. ELIFECYCLE Command failed with…
-
How to decide merge order schemas graphql codegen
0 I’m trying to merge two separate graphql schemas one which is provided by my CMS endpoint and a local schema for additional typehinting (my CMS schema isn’t precise enough). Is there a way to configure the merge order in the graphql codegen config? I’ve been able to merge both schemas and handle the override…
-
Installing graphiql breaks graphql-codegen schema validation [closed]
-2 Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 54 mins ago. Improve this question Which packages are impacted by your issue?…
-
GraphQL codegen using GraphQLError type without importing it
0 This is my codegen config: ‘generated/graphql-sdk.ts’: { config: { rawRequest: true }, plugins: [ "typescript", "typescript-graphql-request", "typescript-operations", { ‘fragment-matcher’: { apolloClientVersion: 3, module: "es2015", useExplicitTyping: false } } ] }, For some reason the generated graphql-sdk doesn’t import GraphQLError causing the typing error, I end up needing to add it in manually. This only…