Unverified Commit 46df2ad4 authored by Dan Jones's avatar Dan Jones
Browse files

fix: assign validator in place of promise

parent bd0feb64
...@@ -27,7 +27,7 @@ class GenericProtocol { ...@@ -27,7 +27,7 @@ class GenericProtocol {
constructor(schema, services) { constructor(schema, services) {
this.schema = schema; this.schema = schema;
this.services = services; this.services = services;
this.validator = this.createValidator(schema); this.createValidator(schema);
} }
/** /**
...@@ -36,7 +36,7 @@ class GenericProtocol { ...@@ -36,7 +36,7 @@ class GenericProtocol {
* @returns {Validator} * @returns {Validator}
*/ */
createValidator(schema) { createValidator(schema) {
return new Validator(schema); this.validator = new Validator(schema);
} }
/** /**
...@@ -116,12 +116,12 @@ class GenericSoarProtocol extends GenericProtocol { ...@@ -116,12 +116,12 @@ class GenericSoarProtocol extends GenericProtocol {
*/ */
createValidator(schema) { createValidator(schema) {
if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) { if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) {
return this.loadSchema(schema) this.loadSchema(schema)
.then((schema) => { .then((schema) => {
return new Validator(schema); this.validator = new Validator(schema);
}); });
} else { } else {
return new Validator(schema); this.validator = new Validator(schema);
} }
} }
......
...@@ -29,7 +29,7 @@ class GenericProtocol { ...@@ -29,7 +29,7 @@ class GenericProtocol {
constructor(schema, services) { constructor(schema, services) {
this.schema = schema; this.schema = schema;
this.services = services; this.services = services;
this.validator = this.createValidator(schema); this.createValidator(schema);
} }
/** /**
...@@ -38,7 +38,7 @@ class GenericProtocol { ...@@ -38,7 +38,7 @@ class GenericProtocol {
* @returns {Validator} * @returns {Validator}
*/ */
createValidator(schema) { createValidator(schema) {
return new Validator(schema); this.validator = new Validator(schema);
} }
/** /**
...@@ -118,12 +118,12 @@ class GenericSoarProtocol extends GenericProtocol { ...@@ -118,12 +118,12 @@ class GenericSoarProtocol extends GenericProtocol {
*/ */
createValidator(schema) { createValidator(schema) {
if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) { if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) {
return this.loadSchema(schema) this.loadSchema(schema)
.then((schema) => { .then((schema) => {
return new Validator(schema); this.validator = new Validator(schema);
}); });
} else { } else {
return new Validator(schema); this.validator = new Validator(schema);
} }
} }
......
...@@ -27,7 +27,7 @@ export class GenericProtocol { ...@@ -27,7 +27,7 @@ export class GenericProtocol {
constructor(schema, services) { constructor(schema, services) {
this.schema = schema; this.schema = schema;
this.services = services; this.services = services;
this.validator = this.createValidator(schema); this.createValidator(schema);
} }
/** /**
...@@ -36,7 +36,7 @@ export class GenericProtocol { ...@@ -36,7 +36,7 @@ export class GenericProtocol {
* @returns {Validator} * @returns {Validator}
*/ */
createValidator(schema) { createValidator(schema) {
return new Validator(schema); this.validator = new Validator(schema);
} }
/** /**
...@@ -116,12 +116,12 @@ export class GenericSoarProtocol extends GenericProtocol { ...@@ -116,12 +116,12 @@ export class GenericSoarProtocol extends GenericProtocol {
*/ */
createValidator(schema) { createValidator(schema) {
if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) { if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) {
return this.loadSchema(schema) this.loadSchema(schema)
.then((schema) => { .then((schema) => {
return new Validator(schema); this.validator = new Validator(schema);
}); });
} else { } else {
return new Validator(schema); this.validator = new Validator(schema);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment