minLength无法处理JSON架构中的字符串

minLength无法处理JSON架构中的字符串,json,node.js,jsonschema,Json,Node.js,Jsonschema,我对node非常陌生,因此可能是因为我使用的JSON模式不正确,如果我错了,请纠正我 我一直在使用名为jsonschema的npm模块 对于使用验证,我使用它的方式如下: var Validator = require('jsonschema').Validator; var v = new Validator(); var instance = { "user_id" : "jesus", "password" : "password" }; var schema

我对node非常陌生,因此可能是因为我使用的JSON模式不正确,如果我错了,请纠正我

我一直在使用名为jsonschema的npm模块

对于使用验证,我使用它的方式如下:

var Validator = require('jsonschema').Validator;
var v = new Validator();
var instance = {
    "user_id"   :   "jesus",
    "password"  :   "password"
};
var schema = {
    "id" : "Login_login",
    "type" : "object",
    "additionalProperties" : false,
    "properties" : {
        "user_id": {
            "type" : "string",
            "required": true,
            "minLenth" : 8,
            "maxLength" : 10,
            "description": "User id to login."
        },
        "password" : {
            "type" : "string",
            "required": true,
            "minLength" : 8,
            "maxLength" : 10,
            "description" : "password to login."
        }
    }
};
var result = v.validate(instance, schema);
console.log('>>>>>> ' + result);
但关键是结果没有错误,尽管用户idminLength保留为8,但我已经超过了5个字符,所以如果我没有错,结果应该为相同的错误抛出一个错误,为什么会这样
:(

模式本身需要验证。它的“用户id”条件“minLength”拼写没有“g”。

注意你如何将
minLength
拼错为
minLenth
。#facepalm,我浪费了将近1个小时,然后你作为救命恩人来了……哈哈,非常感谢……我正在删除这个问题,我不能面对这么多的羞辱……:D