Comments (4)
example:
var descriptor = { id: { type: 'integer', required: false },
name: { type: 'string', min: 3, max: 30 },
email:
{ type: 'string',
min: 7,
pattern: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ },
age: { type: 'integer', required: false },
hands: { type: 'integer', required: false } }
var validator = new schema(descriptor);
validator.validate({name : "Marcos"}, {first : true, single: true}, callback); // error Id
validator.validate({id: 1, name : "Marcos"}, {first : true, single: true}, callback); // ok
validator.validate({id: 1, name : "Marcos"}, callback); // error in all integer fields
from async-validate.
If I understand you correctly I think this was fixed in 4fef115.
Can you confirm please?
from async-validate.
Using your latest release, seems it's not working.
Take a look on these tests bellow. The only tests that seems ok is number 2,
var descriptor = { name: { type: 'string' }, age: { type: 'integer', required: false } } var validator = new schema(descriptor); // 1) error age ; expected null; validator.validate({age: undefined, name : "Marcos"}, {first : false, single: true}, callback); // 2) null; expected null; validator.validate({age: undefined, name : "Marcos"}, {first : true, single: true}, callback); // 3) null; expected error in age; validator.validate({age: 'abc', name : "Marcos"}, {first : true, single: true}, callback);
from async-validate.
Thanks for clarifying, I believe 0.1.17 should work as expected.
I need to review all the test cases and add some code coverage:
from async-validate.
Related Issues (20)
- Rename method type identifier to function
- Implement match property HOT 1
- Implement system schema HOT 1
- Make fields property required (remove shorthand)
- Document match property HOT 1
- Document local property HOT 1
- Document format property HOT 1
- Create command line interface
- ANN: Discuss v1 release HOT 2
- is support for ruleset X or ruleset Y supported? HOT 5
- Support top-level array with resolve HOT 1
- empty string should be raised when rules include `required` HOT 1
- Remove field name in custom error messages HOT 21
- Override global default error messages HOT 2
- How to validate against other values? HOT 6
- pattern.schema.email only allows TLDs of 6 characters HOT 1
- Wrong behavior with deep rules HOT 5
- after invoke some times, the `type: ['string', 'object']` --> `type: ['string']. HOT 5
- about form data validator ,data type is number or date ,from data validator not through. HOT 1
- 非常严重的问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-validate.