强制使用空的JSON模式 [英] enforce empty JSON schema

查看:106
本文介绍了强制使用空的JSON模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个强制执行一个空JSON对象的JSON模式,例如{}

I want a JSON schema that enforces an empty JSON object, e.g. {}

这是个好主意吗?

我尝试了以下操作,但是它允许我在JSON正文中输入任何内容:

I tried the following but it allows me to enter anything in the JSON body:

{
   "description": "voice mail record",
   "type": "object",
   "additionalProperties": false,
   "properties": {
    }
 }

推荐答案

是的,这应该强制使用空模式-我使用的验证器有错误

The answer yes this should enforce an empty schema - the validator I was using had a bug

http://groups.google.co.uk/group/json-schema/browse_thread/thread/d0017b3985c8542b/106ce4afc1763eeb?hl=zh-CN&q=empty+schema+ollie&safe=on

这篇关于强制使用空的JSON模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆