我现在正面临一个应用程序需要验证一个带有JSON Schema定义的表单。
我想知道JavaScript上的validator schema
架构是否JSON
例如:
let validate = schemaValidator.validate('{"title": "Example Schema","type": "object","properties": {"firstName": {"type": "string"},"lastName": {"type": "string"},"age": {"description": "Age in years","type": "integer","minimum": 0}},"required": ["firstName", "lastName"]}', metaSchema);
格式化JSON
{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}
谢谢,