From b77bcad7e9ccd2cdad34859c9e14417d0717275e Mon Sep 17 00:00:00 2001 From: Yann Renaudin Date: Sun, 1 Sep 2019 13:26:14 -0400 Subject: [PATCH 1/2] fix: expose ValidatorError instead of ValidationError --- src/morphism.ts | 12 +++--------- src/validation/Validation.spec.ts | 3 +-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/morphism.ts b/src/morphism.ts index c3cb050..d0452a9 100644 --- a/src/morphism.ts +++ b/src/morphism.ts @@ -6,15 +6,9 @@ import { Schema, StrictSchema, Constructable, SourceFromSchema, Mapper, Destinat import { MorphismSchemaTree, createSchema, SchemaOptions } from './MorphismTree'; import { MorphismRegistry, IMorphismRegistry } from './MorphismRegistry'; import { decorator } from './MorphismDecorator'; -import { - Reporter, - reporter as defaultReporter, - Formatter, - targetHasErrors, - ValidationErrors, - ValidationError -} from './validation/reporter'; +import { Reporter, reporter as defaultReporter, Formatter, targetHasErrors, ValidationErrors } from './validation/reporter'; import { BaseValidator, Rule, Validation } from './validation/Validation'; +import { ValidatorError } from './validation/validators/ValidatorError'; /** * Low Level transformer function. @@ -258,6 +252,6 @@ export { Validation, BaseValidator, Rule, - ValidationError + ValidatorError }; export default Morphism; diff --git a/src/validation/Validation.spec.ts b/src/validation/Validation.spec.ts index fa9394c..a06c3cf 100644 --- a/src/validation/Validation.spec.ts +++ b/src/validation/Validation.spec.ts @@ -1,8 +1,7 @@ import { BaseValidator, Rule, Validation } from './Validation'; import { createSchema } from '../MorphismTree'; -import { morphism, reporter } from '../morphism'; +import { morphism, reporter, ValidatorError } from '../morphism'; import { ValidationError, defaultFormatter } from './reporter'; -import { ValidatorError } from './validators/ValidatorError'; declare module './Validation' { interface IValidation { From 9c92b5edd7f296d304a9dd66c87773d060800451 Mon Sep 17 00:00:00 2001 From: Yann Renaudin Date: Sun, 1 Sep 2019 13:29:09 -0400 Subject: [PATCH 2/2] fix: recover ValidationError from validation/reporter --- src/morphism.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/morphism.spec.ts b/src/morphism.spec.ts index 774b0dd..9d3fd87 100644 --- a/src/morphism.spec.ts +++ b/src/morphism.spec.ts @@ -6,12 +6,11 @@ import Morphism, { SchemaOptions, SCHEMA_OPTIONS_SYMBOL, reporter, - Validation, - ValidationError + Validation } from './morphism'; import { User, MockData } from './utils-test'; import { ActionSelector, ActionAggregator } from './types'; -import { defaultFormatter } from './validation/reporter'; +import { defaultFormatter, ValidationError } from './validation/reporter'; describe('Morphism', () => { const dataToCrunch: MockData[] = [