garycourt / JSV

A JavaScript implementation of an extendable, fully compliant JSON Schema validator.
618 stars 84 forks source link

email validation not wokring #63

Closed Mirodil closed 11 years ago

Mirodil commented 11 years ago

here is my schema

var jsv = require('JSV').JSV.createEnvironment();

jsv.createSchema({
    "$schema": "http://json-schema.org/draft-03/schema#",
    "id": "urn:user#",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "email": {
            "description": "Author email address",
            "type": "string",
            "format": 'email',            
            "required": true
        },
        "password": {
            "description": "User password",
            "type": "string",
            "required": true
        },
        "nickname":{
            "description": "Author nick name",
            "type": "string",
            "maxLength": 50,
            "required": false
        }
    }
});

validate the following JSON data:

{
    "email": "maer007@mail",
    "password": "Hello World",
    "nickname": "Maer"
}

email is invalid but JSV check and there was not any errors.

garycourt commented 11 years ago

Technically that is a valid email address. However, the more important note is that JSV does not validate on the "format" attribute as it is not required by the spec.