Sed*_*Rey 3 javascript validation json jsonschema
我现在面临一个应用程序,它需要验证一个包含 JSON Schema 定义的表单。
我想知道JavaScript 上是否有validator schemafor JSONSchema
例如:
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);
Run Code Online (Sandbox Code Playgroud)
格式化的 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"]
}
Run Code Online (Sandbox Code Playgroud)
谢谢,
| 归档时间: |
|
| 查看次数: |
1168 次 |
| 最近记录: |