Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator would fail if I model the DTO instead of the entity #338

Open
aamancio opened this issue Mar 13, 2022 · 0 comments
Open

Generator would fail if I model the DTO instead of the entity #338

aamancio opened this issue Mar 13, 2022 · 0 comments

Comments

@aamancio
Copy link

I have an entity is Nestjs

@Entity({ name: 'recipes' })
@ObjectType()
export class Recipe {
  @PrimaryGeneratedColumn()
  @Field(() => Int)
  id: number;

  @Column()
  @Field()
  videoUrl: string;

  @Column()
  @Field()
  description: string;
}

I also have a create recipe dto


@InputType()
export class CreateRecipeInput {
  @Field()
  videoUrl: string;

  @Field()
  description: string;

  @Field(() => [String])
  ingredientNames: string[];

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

in my ferry Graphql I have this

mutation CreateRecipe($createRecipeInput: CreateRecipeInput!) {
  createRecipe(createRecipeInput: $createRecipeInput) {
    videoUrl
    description
    ingredientNames
  }
}

The problem I have is if I get an error in the property ingredientNames, but if I add that property to the Recipe entity it works. It's like Ferry is not following the Recipe Dto. When I look at the schema.graphql is flutter The create recipe Dto is there.

input CreateRecipeInput {
  videoUrl: String!
  description: String!

  ingredientNames: [String!]!
  instructionNames: [String!]!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant