question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More information needed on Manual Validation parameters

See original GitHub issue

I come from a php background, where the validation libraries I’m used to, just return true or false (which is awesome), then I do whatever I want from there. So, I opted to use the “Manual validation” here (isEmail precisely), and it worked as expected. (I’m using in a Nativescript application BTW) Problem is with the second parameter, “options”, whose properties are not mentioned at all in the documentation. I just ended up setting allow_display_name, allow_utf8_local_part and require_tld to true without even knowing what they mean. I’d appreciate if these properties (and others like allow_negative_sign_placeholder, host_whitelist and host_blacklist) are explained.

EDIT:: I tried to use the decorators way as shown in the first example, and it worked. BUT console.log("validation failed. errors: ", errors) just outputs ‘validation failed. errors: [object Object]’ in the terminal. So, I really want to stick with the “Manual validation"

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pleerockcommented, Oct 31, 2016

try to install newer version of node

1reaction
pleerockcommented, Oct 30, 2016

My background is also php, and don’t afraid of asynchronous nature of nodejs platform. There are a lot of benefits in using them. Go ahead and use code this way:

async save(object: T) {
     const validationErrors = await this.validate(object);
     if (validationErrors.length > 0)
            throw new Error("validation failed");
}

Using async/await syntax mades code look and understand better. In the case if you still want to use sync validation you can use validateSync method:

async save(object: T) {
     const validationErrors = this.validateSync(object);
     if (validationErrors.length > 0)
            throw new Error("validation failed");
}

but keep in mind that in this case you can loose extra functionality that custom validators can provide. But its actually not a problem if you don’t create custom validators.

Regarding you comment about undocumented options. You can find documentation in validator package which is used by this library.

btw really good validation library never return you just true or false. True or false used in the trivial validation cases. The really powerful validation frameworks in php also return array of validation error details.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ManualValidation@0 - Manual validation v0 task
The Manual Validation task configuration includes an instructions parameter that is used to provide related information or to specify the ...
Read more >
Methods, Method Verification and Validation Volume 2 - FDA
C. ISO/IEC 17025:2017 General requirements for the competence of ... Manual, Volume III Section 6, ORA Method Development and Validation.
Read more >
Validating Parameters - IBM
Validating manual parameters works the same way as validating configuration parameters (described in Configuration Parameters ) with one additional step.
Read more >
Guidance for the Validation of Analytical Methodology and ...
The validation of analytical methods and the calibration of equipment are important aspects of quality assurance in the laboratory. This manual deals with...
Read more >
The NEW Manual Validation Task for Azure DevOps YAML ...
When the Manual validation task is activated during a pipeline, it displays a message bar containing a link that opens the Manual validation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found