GraphQL Codegen isn’t generating types from the in-line fragments

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: CodegenConfig = {
  schema: [
    {
      'https://my-endpoint.com': {
        headers: {
          'Introspection-Key': '8787667676867686678432',
        },
      },
    },
  ],
  documents: ['src/components/**/*.gql'],
  generates: {
    'src/graphql/generated/schema.ts': {
      plugins: [
        'typescript-common',
        'typescript-client',
        'typescript-react-apollo',
      ],
    },
  },
};
export default config;

Somehow GraphQL Codegen isn’t generating the specific fragment data types?


Load 6 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *