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

feat(common): add new flatten options to validation pipe #3173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion content/techniques/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Because this pipe uses the [`class-validator`](https://github.com/typestack/clas
export interface ValidationPipeOptions extends ValidatorOptions {
transform?: boolean;
disableErrorMessages?: boolean;
exceptionFactory?: (errors: ValidationError[]) => any;
exceptionFactory?: (errors: ValidationError[] | string[]) => any;
}
```

Expand Down Expand Up @@ -129,6 +129,16 @@ In addition to these, all `class-validator` options (inherited from the `Validat
<td><code>boolean</code></td>
<td>When set to true, validation of the given property will stop after encountering the first error. Defaults to false.</td>
</tr>
<tr>
<td><code>disableFlattenErrorMessages</code></td>
<td><code>boolean</code></td>
<td>When set to true, the validation errors array will maintain its original structured format as <code>ValidationError</code> objects, rather than being flattened into an array of strings.</td>
</tr>
<tr>
<td><code>flatExceptionFactoryMessage</code></td>
<td><code>boolean</code></td>
<td>When set to true and an exceptionFactory is provided, the validation errors array will be flattened into an array of strings.</td>
</tr>
</table>

> info **Notice** Find more information about the `class-validator` package in its [repository](https://github.com/typestack/class-validator).
Expand Down