validate
validate copied to clipboard
Validate nested object properties in javascript
I keep getting TypeError: validate_1.Schema is not a constructor. My code is below. ``` import Schema from 'validate'; import { IUser } from '../common/interfaces'; const userSchema = new Schema({ userName:...
Fixes #118 Referencing #119
```javascript const schema = new Schema({ number: { type: Number, required: true, }, parent: { type: Object, required: false, properties: { child: { type: Number, required: true, } } }...
I'm trying to figure out how to 'extend' a schema (i.e. create a schema that inherits properties from a parent schema). This is how I'm doing it: ```javascript const Vehicle...
Would be nice to be able to use promises for custom validators. Ideally it should check and wait for the promise to resolve.
My schema looks like this. ``` { "url": { type: String, required: true, use: { urlIncludesProtocol: function (val, inputCtx, path) { return false; // the code stops right here, but...
Currently the code: ``` required(value, ctx, required) { if (required === false) return true; return value != null && value !== ''; }, ``` causes validation to fail on an...
Hello, i'm trying to use validate but i'm encountering a problem with Array type validation. ```js const Schema = require('validate') const userSchema = new Schema({ firstname: { type: 'string', //...
var test= new Schema ({ test:[ {name:{type:String, required:true}} ] }) Input: test.validate({}) // throws no error test.validate({vinod:{}}) // throws no error test.validate({vinod:[]}) // throws no error test.validate([]) // throws no...
closes #102 All previous tests are passing, and relevant ones were made. It seems to work reasonably well from what I can tell so far, I just emulated the behavior...