enforce empty JSON schema

跟風遠走 提交于 2019-12-23 09:25:01

问题


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

Is this a good idea and possible?

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

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

回答1:


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=en&q=empty+schema+ollie&safe=on



来源:https://stackoverflow.com/questions/3521135/enforce-empty-json-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!