example-todo icon indicating copy to clipboard operation
example-todo copied to clipboard

Using TypeGrahql to generate schemas instead of using gpq

Open hatim-heffoudhi opened this issue 4 years ago • 0 comments

Hello, It' will be a nice feature, if we can create a common model or just the model (input and types) in typescript class adding some decorators to generate schema, by using the library typegraphql

@ObjectType()
class Recipe {
  @Field(type => ID)
  id: string;

  @Field()
  title: string;

  @Field({ nullable: true })
  description?: string;

  @Field()
  creationDate: Date;

  @Field(type => [String])
  ingredients: string[];
}

with this, we can avoid boilerplate code and some duplicates...

hatim-heffoudhi avatar Jul 06 '20 14:07 hatim-heffoudhi