Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8050026
  • 博文数量: 594
  • 博客积分: 13065
  • 博客等级: 上将
  • 技术积分: 10324
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-26 16:44
个人简介

推荐: blog.csdn.net/aquester https://github.com/eyjian https://www.cnblogs.com/aquester http://blog.chinaunix.net/uid/20682147.html

文章分类

全部博文(594)

分类: C/C++

2020-07-21 14:41:04

要求JSON中的所有keys名只能由下划线、字母和数字组成,且必须以下划线或字母打头:

{

  "type": "object",

  "propertyNames": {

    "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"

  }

}

 

要求JSON中的所有以“I_”打头的keysvalues只能为整数:

{

  "type": "object",

  "patternProperties": {

    "^I_": { "type": "integer" }   

  },

  "additionalProperties": false

}

 

要求JSON中所有的values只能为字符串:

{

  "type": "object",

  "additionalProperties": { "type": "string" }

}

 

以上两种的结合:

{

  "type": "object",

  "properties": {

    "builtin": { "type": "number" }

  },

  "patternProperties": {

    "^S_": { "type": "string" },

    "^I_": { "type": "integer" }

  },

  "additionalProperties": { "type": "string" }

}

 

以上内容来源:

阅读(107015) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~