JSON Schema:用于描述JSON文档的媒体类型
官方文档:http://json-schema.org/
关键字的文档:http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5
首参考博客:https://blog.csdn.net/xiong9999/article/details/53688336
(说明了关键字的意义)
github文档:https://github.com/json-editor/json-editor
(待学习 $rel引用, format,checkbox 怎么变成选框,enum枚举 有时间需要学习)
参考以下博客:
博客:https://blog.csdn.net/taiyangdao/article/details/77865622
博客:https://www.cnblogs.com/fengxiongZz/p/6687058.html
博客:https://blog.csdn.net/bystarlight/article/details/72467822
博客:https://www.jianshu.com/p/8278eb2458c4?winzoom=1
关键字:
验证数组关键字:
定义了 “type”:“array”后,必须有
(1)items --》代表数组的每一项
(2)maxItems --》数组的最大长度
(3)minItems --》数组的最小长度
(4) uniqueItems --> 布尔值, 为 true时表示数组的每一项唯一性
编写的第一个Schema文件:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"defaultProperties":[
"hero",
"recommendSkin",
"skin"
],
"properties":{
"hero":{
"type":"array",
"id":"/properties/hero",
"title": "hero",
"description":"11",
"items":{
"type": "object",
"id": "/properties/hero/items",
"defaultProperties":["actUrl", "hotTag","id", "imgUrl","name","title"],
"properties":{
"actUrl":{
"type": "string",
"id": "/properties/hero/items/actUrl",
"title": "actUrl",
"default": "http://lol.qq.com/act/a20180514pyke/index.html",
"description": "acturl Notknow"
},
"hotTag":{
"type": "string",
"id": "/properties/hero/items/hotTag",
"title":