Migrating from apollo client:codegen to graphql-codegen

44 Views Asked by At

I am trying to migrate from `apollo client:codegen --target=typescript --outputFlat Which generated a type like

export interface GetTeamStuffFields_getTeamStuffFields_fields {
  __typename: "TeamStuffField";
  name: string;
  label: string;
  options: GetTeamStuff_getTeamStuffFields_fields_options[] | null;
}

Using graphql-codegen it changes completely and generates the type like

export type GetTeamStuffQuery = {
  readonly getTeamStuffFields: ReadonlyArray<{
    readonly __typename: "TeamStuffSection";
    readonly name: string;
    readonly label: string;
    fields: ReadonlyArray<{
      readonly __typename: "TeamStuffField";
      readonly name: string;
      readonly label: string;
      readonly fieldType: TeamStuffType | null;
      readonly options: ReadonlyArray<{
        readonly __typename: "TeamStuffOption";
        readonly value: string;
        readonly label: string;
      }>;
    }>;
  }>;
};

Which would mean I need to migrate all the references, this issue is that we have 100s of these so we would rather get the generator to generate the types how they were before, Is this still possible?

I have tried changing the codegen file with no luck of generating anything similar to what we had. Types with underscores

0

There are 0 best solutions below