From 032b97b16af416f452161e88626a82a97a26578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lytek?= Date: Sun, 10 Nov 2019 21:48:17 +0100 Subject: [PATCH] docs(inputs): add info about validating nested inputs --- CHANGELOG.md | 1 + docs/validation.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 854d24315..eaf8a71ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - add basic support for directives with `@Directive()` decorator (#369) ### Fixes - refactor union types function syntax handling to prevent possible errors with circular refs +- fix transforming and validating nested inputs and arrays (#462) ## v0.17.5 ### Features diff --git a/docs/validation.md b/docs/validation.md index 0f878ff11..dff6f9cb9 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -98,6 +98,8 @@ Note that by default, the `skipMissingProperties` setting of the `class-validato GraphQL will also check whether the fields have correct types (String, Int, Float, Boolean, etc.) so we don't have to use the `@IsOptional`, `@Allow`, `@IsString` or the `@IsInt` decorators at all! +However, when using nested input or arrays, we always have to use [`@ValidateNested()` decorator](https://github.com/typestack/class-validator#validating-nested-objects) or [`{ each: true }` option](https://github.com/typestack/class-validator#validating-arrays) to make nested validation work properly. + ## Response to the Client When a client sends incorrect data to the server: