Questions tagged [graphql-codegen]

182 questions
0
votes
0 answers

Vue: How to re-use (fragment) types generated by graphql-codegen, typescript-operations and typescript-vue-urql?

I'm using typescript-vue-urql to generate some awesome composition functions for my graphql queries. This is my codegen.ts const config: CodegenConfig = { schema: "https://myschema.com", documents: ["**/*.graphql"], ignoreNoDocuments: true, …
TdeBooij
  • 212
  • 1
  • 2
  • 6
0
votes
0 answers

How do I prevent re-export in generated 'index.ts' by graphql-codegen

I use @graphql/codegen-cli to autogenerate my graphql typings using the below config... import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { overwrite: true, schema: 'schema.graphql', documents:…
0
votes
0 answers

Create inline query from GraphQL request

I'm generating graphql queries using graphql-codegen along with typescript-graphql-request. It works fine, but the generated client produces queries in the following format: {   "query": "query getUser($id: String!) { getUser(eid: $eid) { id title }…
Johan
  • 35,120
  • 54
  • 178
  • 293
0
votes
0 answers

How to use template strings with graphql-codegen?

I have this GraphQL query in a TypeScript file: const someVar = 'getUser' export const SOME_QUERY = gql` query ${someVar} { user { name } } ` but when I run graphql-codegen to generate the types, I get this message in the…
JoeTidee
  • 24,754
  • 25
  • 104
  • 149
0
votes
1 answer

How do I get type target?.history from GitHub GraphQL on defaultBranchRef

I'm trying to get the last commit with typesaftey but can't get past the history property because it can be an empty object, {}, null, undefined, or the actual object I want, Commit. My GitHub GraphQL query is query OrgReposAgExtended_v3( …
DFBerry
  • 1,818
  • 1
  • 19
  • 37
0
votes
1 answer

Graphql Codegen Duplicating Document Fields

I have setup codegen.ts as follows: import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { overwrite: true, schema: 'http://localhost:3333/graphql', documents: 'libs/graphql/**/*.graphql', …
Kelveen
  • 90
  • 7
0
votes
0 answers

GitHub GraphQL paging through repositories changed?

A month or 2 ago I wrote a query and codegen'd it into an SDK and deployed the code: query OrgReposAg( $organization: String! $pageSize: Int $after: String ) { organization(login: $organization) { repositories( after: $after …
DFBerry
  • 1,818
  • 1
  • 19
  • 37
0
votes
0 answers

graphqql codegen enums are not found when referenced in resolvers

My schema is defined: export default gql` enum MyCoolEnum { A B C } extend type Mutation { changeValue( valueToChange: MyCoolEnum! ): JSON } `; Which produces the following in the generatedSchema export enum…
Afs35mm
  • 549
  • 2
  • 8
  • 21
0
votes
0 answers

How can I create a recursive TypeScript utility for deeply nested nullable fields using lookup types?

I'm using graphql-codegen which has generated the following type: type GetMenuQuery = { __typename?: "RootQuery" menu?: { __typename?: "Menu" id: string menuItems?: { __typename?: "MenuToMenuItemConnection" nodes:…
0
votes
1 answer

Convert Prisma model to GraphQL model automatically

Given Prisma schema: model companiesOnUsers { company company @relation(fields: [companyId], references: [id]) companyId Int user user @relation(fields: [userId], references: [id]) userId Int role companyRoles…
Daniel
  • 839
  • 10
  • 20
0
votes
0 answers

Call my graphql endpoint through another webapp

I have a backend application(let's call it App A) with a grahql endpoint. It's a NodeJs with Nest framework. The queries on the frontend are generated with codegen (https://the-guild.dev/graphql/codegen). Both frontend and backend are hosted…
Iosif Bujor
  • 89
  • 2
  • 9
0
votes
0 answers

GraphQL - How can I tell if my delete mutation has been created?

My react, apollo, prisma, nextjs typescript app seems to think I have not made a deleteIssueGroup mutation. I think I have. I am using: "devDependencies": { "@graphql-codegen/add": "3.2.1", "@graphql-codegen/cli": "2.13.7", …
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
1 answer

GraphQL codegen cli fails on fragment files

I have a deeply nested graphql for GitHub which deep inside returns info about repositories. I would like to pull out the repository object into a fragment then reference that fragment in the original query. The file type is *.graphql. I've tried…
DFBerry
  • 1,818
  • 1
  • 19
  • 37
0
votes
0 answers

Can't generate graphql file graphql-codegen Cannot use GraphQLInterfaceType "AbstractEntity" from another module or realm

I'm trying to generate my graphql file by running graphql-codegen --config codegen.yml and I'm getting this error: Error: Cannot use GraphQLInterfaceType "AbstractEntity" from another module or realm. Ensure that there is only one instance…
Brace Sproul
  • 593
  • 1
  • 5
  • 15
0
votes
1 answer

How can I generate base, flat, inline TypeScript types, based on GraphQL schema

Is it possible to generate from GraphQL schema TypeScript types, that can be used with common REST API? We are working with a CMS, that provides GraphQL and REST API-s. It was decided by higher-ups to use REST. But we still want to have some code…