Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace input validation of url params by generic validation method #1

Open
remkohdev opened this issue Jan 15, 2018 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@remkohdev
Copy link
Owner

Currently, e.g. in histohour.js, input validation is implemented for each param, required and optional, with a lot of repetitive code:

// optional fields
// extraParams
if(msg.params && msg.params.extraParams){
urlParams.push("extraParams="+msg.params.extraParams);
}else{
if(node.extraParams || node.extraParams!=""){
urlParams.push("extraParams="+ node.extraParams);
}
}
// sign
if(msg.params && msg.params.sign){
urlParams.push("sign="+msg.params.sign);
}else{
if(node.sign || node.sign!=""){
urlParams.push("sign="+ node.sign);
}
}

This should be replaced by a generic method, to which you pass: the full input object and with a params setting or config object, the method should validate if input object complies to paramsConfig object.

@remkohdev remkohdev added enhancement New feature or request good first issue Good for newcomers labels Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Development

No branches or pull requests

1 participant