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 {
constructor(schema, services) {
this.schema = schema;
this.services = services;
this.validator = this.createValidator(schema);
this.createValidator(schema);
}
/**
......@@ -36,7 +36,7 @@ class GenericProtocol {
* @returns {Validator}
*/
createValidator(schema) {
return new Validator(schema);
this.validator = new Validator(schema);
}
/**
......@@ -116,12 +116,12 @@ class GenericSoarProtocol extends GenericProtocol {
*/
createValidator(schema) {
if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) {
return this.loadSchema(schema)
this.loadSchema(schema)
.then((schema) => {
return new Validator(schema);
this.validator = new Validator(schema);
});
} else {
return new Validator(schema);
this.validator = new Validator(schema);
}
}
......
......@@ -29,7 +29,7 @@ class GenericProtocol {
constructor(schema, services) {
this.schema = schema;
this.services = services;
this.validator = this.createValidator(schema);
this.createValidator(schema);
}
/**
......@@ -38,7 +38,7 @@ class GenericProtocol {
* @returns {Validator}
*/
createValidator(schema) {
return new Validator(schema);
this.validator = new Validator(schema);
}
/**
......@@ -118,12 +118,12 @@ class GenericSoarProtocol extends GenericProtocol {
*/
createValidator(schema) {
if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) {
return this.loadSchema(schema)
this.loadSchema(schema)
.then((schema) => {
return new Validator(schema);
this.validator = new Validator(schema);
});
} else {
return new Validator(schema);
this.validator = new Validator(schema);
}
}
......
......@@ -27,7 +27,7 @@ export class GenericProtocol {
constructor(schema, services) {
this.schema = schema;
this.services = services;
this.validator = this.createValidator(schema);
this.createValidator(schema);
}
/**
......@@ -36,7 +36,7 @@ export class GenericProtocol {
* @returns {Validator}
*/
createValidator(schema) {
return new Validator(schema);
this.validator = new Validator(schema);
}
/**
......@@ -116,12 +116,12 @@ export class GenericSoarProtocol extends GenericProtocol {
*/
createValidator(schema) {
if (typeof schema === 'string' && schema.match(/^[\w\.]+$/)) {
return this.loadSchema(schema)
this.loadSchema(schema)
.then((schema) => {
return new Validator(schema);
this.validator = new Validator(schema);
});
} 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