From 32651b5cfd2916366dea40d986dfe624f792d3b6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 10 Jun 2018 10:58:30 +0100 Subject: [PATCH] fix: compileAsync schema with multiple remote schemas and some recursive, fixes #801 --- lib/ajv.js | 4 ++++ spec/async.spec.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ajv.js b/lib/ajv.js index 3f71001..4740eb6 100644 --- a/lib/ajv.js +++ b/lib/ajv.js @@ -351,6 +351,10 @@ function _compile(schemaObj, root) { var v; try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); } + catch(e) { + delete schemaObj.validate; + throw e; + } finally { schemaObj.compiling = false; if (schemaObj.meta) this._opts = currentOpts; diff --git a/spec/async.spec.js b/spec/async.spec.js index beb8412..5b4c5ff 100644 --- a/spec/async.spec.js +++ b/spec/async.spec.js @@ -430,7 +430,7 @@ describe('compileAsync method', function() { }); - describe.skip('schema with multiple remote properties, the first is recursive schema (#801)', function() { + describe('schema with multiple remote properties, the first is recursive schema (#801)', function() { it('should validate data', function() { var schema = { "$id": "http://example.com/list.json",