Skip to content
Discussion options

You must be logged in to vote

Turns out I should have probably read the documentation closer.

There is a section on validating nested objects, and as far as I can tell this is working as advertised.

In case anybody finds this and the exact syntax isn't clear to you, this is what worked for me. In my top level NewProductInput example above, I added @ValidateNested({ each: true }) - in my case { each: true } was required because I have an array of PricingInput's. After adding this decorator, my PricingInput validator(s) fired as expected.

// .../resolvers/product-input.ts

...

import { ProductInput } from './product-input-type';

@InputType()
export class NewProductInput {
  @Field({ nullable: true })
  structure?: str…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kevin-mitchell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant