Can JSON integer attributes be referenced?

佐手、 提交于 2019-12-02 07:57:51

The JSON Reference spec doesn't place any limits on what can be $ref'd, but in practice, any validator that I have ever seen only supports $refs that point to a JSON Schema. I'm not sure why none ever supported that functionality, but I have yet to see a case where I thought it was a good idea to do such a thing.

In the recently released JSON Schema draft-06, the common practice of supporting only JSON Schemas became a rule. So, even if you do find a validator that supports $refing integers, I wouldn't recommend using it because it will make it harder to upgrade in the future.

This won't work this way. $ref references must always point to schemas. So it can be an object or a boolean, but not a number.

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