prisma-labs/graphqlgen

graphql enum results in incorrect suggested model

jasonkuhrt opened this issue · 3 comments

Given schema:

type SomeType {
  someEnum: SomeEnum
}
enum SomeEnum {
  A_VALUE
  ANOTHER_VALUE
}

graphqlgen suggests model (when no SomeType model is supplied by user):

export interface SomeType {
  someEnum: string | null
}

but, should be:

type SomeEnum =
  | 'A_VALUE'
  | 'ANOTHER_VALUE'

export interface SomeType {
  someEnum: SomeEnum | null
}

related

Given that schema, shouldn't the typescript be:

export type SomeEnum = 'A_VALUE' | 'ANOTHER_VALUE'
export interface SomeType {
  someEnum: SomeEnum | null
  someString: string | null
}

Looks like only scalar fields are shown in the suggested model.

@nunovieira Thanks, example fixed