@travetto/schema 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/schema",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Data type registry for runtime validation, reflection and binding.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"schema",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"directory": "module/schema"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/registry": "^4.0.
|
|
30
|
+
"@travetto/registry": "^4.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@travetto/transformer": "^4.0.
|
|
33
|
+
"@travetto/transformer": "^4.0.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@travetto/transformer": {
|
package/src/validate/error.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { ValidationError } from './types';
|
|
|
6
6
|
*
|
|
7
7
|
* Hold all the validation errors for a given schema validation
|
|
8
8
|
*/
|
|
9
|
-
export class ValidationResultError extends AppError {
|
|
10
|
-
constructor(
|
|
9
|
+
export class ValidationResultError extends AppError<{ errors: ValidationError[] }> {
|
|
10
|
+
constructor(errors: ValidationError[]) {
|
|
11
11
|
super('Validation errors have occurred', 'data', { errors });
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -311,9 +311,9 @@ export class SchemaValidator {
|
|
|
311
311
|
await this.validate(cls, o, view);
|
|
312
312
|
} catch (err) {
|
|
313
313
|
if (err instanceof ValidationResultError) { // Don't check required fields
|
|
314
|
-
const errs = err.errors.filter(x => x.kind !== 'required');
|
|
314
|
+
const errs = err.details!.errors.filter(x => x.kind !== 'required');
|
|
315
315
|
if (errs.length) {
|
|
316
|
-
err.errors = errs;
|
|
316
|
+
err.details!.errors = errs;
|
|
317
317
|
throw err;
|
|
318
318
|
}
|
|
319
319
|
}
|