1
在spec http://json-schema.org/latest/json-schema-core.html,它只以下類型列表: 空, 布爾,字符串 , 數, 對象, 陣列。JSON模式類型整數
我知道數字包括整數,但我可以明確定義「類型」:「整數」。我的意思是這會違反規範嗎?
在spec http://json-schema.org/latest/json-schema-core.html,它只以下類型列表: 空, 布爾,字符串 , 數, 對象, 陣列。JSON模式類型整數
我知道數字包括整數,但我可以明確定義「類型」:「整數」。我的意思是這會違反規範嗎?
是的,您可以在架構中使用{"type": "integer"}
。
參見:
https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.2
還有的JSON模式GitHub的頁面上詢問的正是這種問題... https://github.com/json-schema-org/json-架構規格/問題/ 272 –