mirror of
https://github.com/vale981/grapher
synced 2025-03-05 09:31:42 -05:00
_validateAndClean actually accepts param now
This commit is contained in:
parent
bc296b9dc5
commit
0913e08910
1 changed files with 12 additions and 13 deletions
|
@ -53,20 +53,19 @@ export default class Exposure {
|
||||||
this.initCountMethod();
|
this.initCountMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
_validateAndClean() {
|
_validateAndClean(config) {
|
||||||
if (typeof(this.config) === 'function') {
|
if (typeof(config) === 'function') {
|
||||||
const firewall = this.config;
|
const firewall = config;
|
||||||
this.config = {firewall};
|
config = {firewall};
|
||||||
|
}
|
||||||
|
config = ExposureConfigSchema.clean(config);
|
||||||
|
ExposureConfigSchema.validate(config);
|
||||||
|
|
||||||
|
if (config && config.body) {
|
||||||
|
ExposureConfigSchema.validateBody(this.collection, config.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.config = ExposureConfigSchema.clean(this.config);
|
return _.extend({}, Exposure.getConfig(), config);
|
||||||
ExposureConfigSchema.validate(this.config);
|
|
||||||
|
|
||||||
if (this.config && this.config.body) {
|
|
||||||
ExposureConfigSchema.validateBody(this.collection, this.config.body);
|
|
||||||
}
|
|
||||||
|
|
||||||
return _.extend({}, Exposure.getConfig(), this.config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,4 +206,4 @@ export default class Exposure {
|
||||||
return findOne(filters, options);
|
return findOne(filters, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue