Questions tagged [graphql-codegen]

182 questions
0
votes
0 answers

I am unable to generate a schema types using codegen

I get an error like this when I create a my codegen.yml file. And I tried using codegen.json instead but the command "npx graphql-codegen" does not generates the code. However I have added the "generates":graphql-codegen" in my scripts in the…
0
votes
0 answers

Facing incompatible module issue with inotify when try to install codegen

I tried to install codegen in react application using the below comment npm install --save-dev @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-react-apollo and i got the below…
Gtm
  • 35
  • 3
0
votes
1 answer

GraphQl Code Generator doesn't generate graphql() properly in Next.js

I use GraphQL in next.js project and generate types for query. But code generator doesn't generate properly. it's says "The query argument is unknown! Please regenerate the types." in gql.ts file. Here you can see type error: Code generator…
0
votes
0 answers

How to implement @defer queries with Apollo GraphQL Client in Angular using graphql codegen?

I am trying to implement @defer queries with the Apollo GraphQL Client in an Angular project. I have the latest versions of the required libraries, but I'm unable to find any documentation or examples online that explain how to achieve this. I have…
Rich
  • 3,928
  • 4
  • 37
  • 66
0
votes
1 answer

Typesafety on GraphQL query template literals in Svelte?

I'm using graphql-codegen to generate typescript types for my graphql queries in my sveltekit project. However, graphql-codegen doesn't seem to recognize queries in template literals in my svelte files. The urql docs show an example using graphql…
minnow
  • 183
  • 8
0
votes
0 answers

How can the generated codegen query be minimized to its parent interface only?

I am working on graphql-codegen I have this graphql query export const QUERY=gql` query fetchView($workId: String!, $dataType: String, $lockedDTO: LockedDTOInput!) { fetchView (workId: $workId) { id } }`; any my resulting query is export…
0
votes
1 answer

codegen "typescript-react-apollo" plugin is redeclaring block-scope variables in generated output

I've just started a new project that uses NextJS with graphql-codegen to generate my apollo-react types from my api. However, right off the bat it's creating duplicate exported variables and I can't build my project due to the typescript error. Any…
kevin
  • 2,707
  • 4
  • 26
  • 58
0
votes
0 answers

Big graphql query with multiple fragments -- how do I get this to work?

I am having issues generating my types using graphql-codegen. My query contains a fragment called AssessmentQuestionnaireType which uses smaller fragments. Each of these fragments contains an options field that varies in the data type of its value…
nyphur
  • 2,404
  • 2
  • 24
  • 48
0
votes
1 answer

DuplicatedOperationError when creating Graphql Subscription from flutter to AWS AppSync

I have a flutter frontend where I use graphql_flutter to connect to an AWS AppSync graphql API. Queries and Mutations work exactly as expected. I am also able to establish a WebSocket connection for a subscription, but when I(graphql_flutter) send…
0
votes
2 answers

cannot find module 'stream/web' @graphql-codegen/cli@4.0.1

I am falling on this error when trying to user codegen@4.0.1
Redskinsjo
  • 88
  • 8
0
votes
0 answers

Graphql codegen is always type unknown

I'm working in a SvelteKit project and want to use gql codegen, but all queries are typed as unknown. Ts file: import { graphql } from '$lib/gql/index.js'; export const getPostById = graphql(` query GET_ARTICLE($id: bigint!) { …
Niro
  • 142
  • 9
0
votes
0 answers

Replacing Scalars with their primitive counterparts with graphql-codegen

Using graphql-codegen to generate Typescript types and operations works like a charm using the typescript and typescript-operations plugins. However the typescript plugin emits types that use Scalar types instead of primitive types: /** All built-in…
judehall
  • 884
  • 12
  • 27
0
votes
0 answers

How to generate TypeScript types for a Hasura SQL function?

I followed the guide in the docs to create a custom SQL function. However, I am having trouble generating types for it on my frontend. This is what my function looks like: CREATE OR REPLACE FUNCTION public.search_deals( search text, …
chomprrr
  • 406
  • 4
  • 15
0
votes
0 answers

cannot use useMutation() with generated code by graph-ql codegen

I'm fairly new to Next.js and frond-end development itself. I am trying to use graphql-codegen to produce types in GraphQl, but somehow I get type error. I immitate the public document, but cannot solve the error. The code is below: import {…
Kazuya Tomita
  • 667
  • 14
  • 34
0
votes
0 answers

Accessing extensions in generated types with graphql-codegen and react-query

Here's what my returned GQL data looks like: { "data": { "Orders": [ ... ] }, "extensions": { "unlimitedTotal": { "Orders": 3534 } } } My issue is that the types generated by graphql-codegen only include the…
byoda
  • 132
  • 2
  • 4