apigee/microgateway-config

Should the init and load functions use the default-validator.js module to validate correctness of config file?

Opened this issue · 0 comments

I noticed that this module's get function, which uses /lib/network.js will utilize the /lib/default-validator.js module to assert some expected config properties, however it looks to me like the init function, which appears to perform a similar behavior (just locally as opposed to over the network), does not use default-validator.js

The load function in io.js also doesn't use the default-validator.js module.

If it is intentional that these two functions don't use default-validator.js then would it make sense to add a helper function that I could call to validate my config.yaml at will?

Example end user code:

let configlib = require('microgateway-config')
let config = configlib.load({ source: './my-config.yaml'})
console.log(config.isValid())    // => true if config was valid