Is there a way to remove Maybe and Scalars with GraphQl Codegen?
Asked Answered
B

0

6

I'm using GraphQl Codegen with the typescript and typescript-operations plugins, but the file generated contains a tone of Maybe and Scalars making the file look very messy.

export type Formation = {
  availability?: Maybe<Scalars['String']>;
  certificate?: Maybe<Scalars['String']>;
  description?: Maybe<Scalars['String']>;
  id: Scalars['ID'];
  imageId?: Maybe<Scalars['ID']>;
  imageUrl?: Maybe<Scalars['String']>;
  languageIds?: Maybe<Array<Scalars['ID']>>;
  languages?: Maybe<Array<Maybe<Taxonomy>>>;
  levelId?: Maybe<Scalars['ID']>;
  location?: Maybe<Taxonomy>;
  locationId?: Maybe<Scalars['ID']>;
  objective?: Maybe<Scalars['String']>;
  professionIds?: Maybe<Array<Scalars['ID']>>;
  requirementIds?: Maybe<Array<Scalars['ID']>>;
  sectorIds?: Maybe<Array<Scalars['ID']>>;
  tagIds: Array<Scalars['ID']>;
  title: Scalars['String'];
  typeId?: Maybe<Scalars['ID']>;
  updatedAt: Scalars['String'];
  urlFormation?: Maybe<Scalars['String']>;
};

Is it possible to output the primitive type:

string | null

Instead of:

Maybe<Scalars["String"]>

Thanks!

Barye answered 20/5, 2022 at 15:48 Comment(1)
have you found a solution to this? i'm facing similar problemViator

© 2022 - 2024 — McMap. All rights reserved.