diff --git a/packages/angular-material/test/autocomplete-control.spec.ts b/packages/angular-material/test/autocomplete-control.spec.ts index 678f43af8f..777613ef43 100644 --- a/packages/angular-material/test/autocomplete-control.spec.ts +++ b/packages/angular-material/test/autocomplete-control.spec.ts @@ -293,7 +293,7 @@ describe('AutoComplete control Error Tests', () => { it('should display errors', () => { const errors: ErrorObject[] = [ { - instancePath: '.foo', + instancePath: '/foo', message: 'Hi, this is me, test error!', params: {}, keyword: '', diff --git a/packages/angular-material/test/date-control.spec.ts b/packages/angular-material/test/date-control.spec.ts index 3787cd520e..27a4330183 100644 --- a/packages/angular-material/test/date-control.spec.ts +++ b/packages/angular-material/test/date-control.spec.ts @@ -257,7 +257,7 @@ describe('Date control Error Tests', () => { const formsService = getJsonFormsService(component); formsService.updateCore(Actions.updateErrors([ { - instancePath: '.foo', + instancePath: '/foo', message: 'Hi, this is me, test error!', params: {}, keyword: '', diff --git a/packages/angular-test/src/boolean.ts b/packages/angular-test/src/boolean.ts index 0e761b0a08..f33489fdc5 100644 --- a/packages/angular-test/src/boolean.ts +++ b/packages/angular-test/src/boolean.ts @@ -281,7 +281,7 @@ export const booleanErrorTest = ( }); formsService.updateCore(Actions.updateErrors([ { - instancePath: '.foo', + instancePath: '/foo', message: 'Hi, this is me, test error!', keyword: '', schemaPath: '', diff --git a/packages/angular-test/src/number.ts b/packages/angular-test/src/number.ts index d0c7011359..c5d686677f 100644 --- a/packages/angular-test/src/number.ts +++ b/packages/angular-test/src/number.ts @@ -346,7 +346,7 @@ export const numberErrorTest = ( }); formsService.updateCore(Actions.updateErrors([ { - instancePath: '.foo', + instancePath: '/foo', message: 'Hi, this is me, test error!', keyword: '', schemaPath: '', diff --git a/packages/angular-test/src/range.ts b/packages/angular-test/src/range.ts index ceb93a868f..74c5b82479 100644 --- a/packages/angular-test/src/range.ts +++ b/packages/angular-test/src/range.ts @@ -324,7 +324,7 @@ export const rangeErrorTest = ( }); formsService.updateCore(Actions.updateErrors([ { - instancePath: '.foo', + instancePath: '/foo', message: 'Hi, this is me, test error!', keyword: '', schemaPath: '', diff --git a/packages/angular-test/src/text.ts b/packages/angular-test/src/text.ts index 763d553bfe..2802ba40b3 100644 --- a/packages/angular-test/src/text.ts +++ b/packages/angular-test/src/text.ts @@ -293,7 +293,7 @@ export const textErrorTest = ( }); formsService.updateCore(Actions.updateErrors([ { - instancePath: '.foo', + instancePath: '/foo', message: 'Hi, this is me, test error!', keyword: '', schemaPath: '', diff --git a/packages/core/src/reducers/core.ts b/packages/core/src/reducers/core.ts index d706c38d06..b6c5ce546b 100644 --- a/packages/core/src/reducers/core.ts +++ b/packages/core/src/reducers/core.ts @@ -318,17 +318,17 @@ export const getControlPath = (error: ErrorObject) => { } // dataPath was renamed to instancePath in AJV v8 var controlPath: string = error.instancePath; - const invalidProperty = getInvalidProperty(error); - if (invalidProperty !== undefined && !controlPath.endsWith(invalidProperty)) { - controlPath = `${controlPath}.${invalidProperty}`; - } - // remove '.' chars at the beginning of paths - controlPath = controlPath.replace(/^./, ''); - // change array paths to dot notation (e.g. 'segment[0]' becomes 'segment.0') - controlPath = controlPath.replace( - /\[\d+\]/g, - m => '.' + m.match(/\d+/g)[0] - ); + + // change '/' chars to '.' + controlPath = controlPath.replace(/\//g, '.'); + + const invalidProperty = getInvalidProperty(error); + if (invalidProperty !== undefined && !controlPath.endsWith(invalidProperty)) { + controlPath = `${controlPath}.${invalidProperty}`; + } + + // remove '.' chars at the beginning of paths + controlPath = controlPath.replace(/^./, ''); return controlPath; } diff --git a/packages/core/src/util/validator.ts b/packages/core/src/util/validator.ts index 4610833f7e..6321fa8b8c 100644 --- a/packages/core/src/util/validator.ts +++ b/packages/core/src/util/validator.ts @@ -29,7 +29,6 @@ import { Options } from 'ajv'; export const createAjv = (options?: Options) => { const ajv = new Ajv({ allErrors: true, - jsPropertySyntax: true, verbose: true, ...options }); diff --git a/packages/core/test/reducers/core.test.ts b/packages/core/test/reducers/core.test.ts index 25081724f6..ab5e8a5e31 100644 --- a/packages/core/test/reducers/core.test.ts +++ b/packages/core/test/reducers/core.test.ts @@ -502,7 +502,7 @@ test('core reducer - updateErrors - should update errors with error', t => { }; const error = { - instancePath: 'color', + instancePath: '/color', keyword: 'enum', message: 'should be equal to one of the allowed values', params: { diff --git a/packages/core/test/util/renderer.test.ts b/packages/core/test/util/renderer.test.ts index 87a3667759..bfbcb2c3a2 100644 --- a/packages/core/test/util/renderer.test.ts +++ b/packages/core/test/util/renderer.test.ts @@ -384,7 +384,7 @@ test('mapStateToControlProps - errors', t => { }; const clonedState = _.cloneDeep(createState(coreUISchema)); const error: ErrorObject = { - instancePath: '.firstName', + instancePath: '/firstName', message: 'Duff beer', keyword: 'whatever', schemaPath: '',