ValidateNested() on nested objects
See original GitHub issueHi, For instance, I have my inputType class:
@InputType()
export class ReadingCreateInput {
@Field(() => Int, { nullable: false })
@IsNegative()
reading!: number;
@Field(() => Int, { nullable: false })
previousReading!: number;
@HideField()
excessAmount!: number;
@HideField()
basicAmount!: number;
@HideField()
createdAt?: Date | string;
}
I want to validate the field reading
, to do that I need that the args class associated has the decorator @ValidateNested()
Something like this:
@ArgsType()
export class CreateOneReadingArgs {
@Field(() => ReadingCreateInput, { nullable: false })
@ValidateNested()
data!: ReadingCreateInput;
}
Is there a way to set the decorator @ValidateNested()
to the @Args()
and to any generated nested object, setting a property to the nestgraphql
generator?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Validating nested objects with class-validator in NestJS
Today I have for you a quick and short article. Maybe it will help someone. I'm using class-validator for request validation in NestJS ......
Read more >validate nested objects using class-validator in nest.js controller
Try specifying the nested type with @Type : import { Type } from 'class-transformer'; export class CurrencyDTO { @ValidateNested({ each: ...
Read more >ValidateNested does not work · Issue #443 · nestjs/nest - GitHub
When using ValidateNested from class-validator to validate a nested object on a dto, the validation passes successfully with invalid nested ...
Read more >Validate a nested array of objects GET query parameter using ...
Then set @ValidateNested({ each: true }) , and @Type(() => YourClass in my validation schema, like this. import { DictionnaryOfValues } from './ ......
Read more >Nested Objects and Arrays - VeeValidate
Nested Objects. You can specify a field to be nested in an object using dot paths, like what you would normally do in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@grodasgomez Try version from
@next
channel.Config should look like:
🎉 This issue has been resolved in version 14.2.0 🎉
The release is available on:
Your semantic-release bot 📦🚀