我們與格式屬性JSON模式,下面的代碼片段:JSON模式 - 格式屬性與JSON.Net
"properties": {
"expireDateTime": {
"description": "Date when the time will expire. If granularity is at the date level then YYYY-MM-DD is passed. If the granularity is at the hour/minute level then the date time format is YYYY-MM-DDThh:mm:ss+-hh:mm",
"type": "string",
"format": [ "date-time", "date" ]
} }
我們正在使用從NewtonSoft的Json.Net解析器處理它。這用於正確解析先前版本的框架(v6.x),該框架僅支持草案3.使用支持草案4的最新版本的框架,我得到一個錯誤,即格式不能是數組。
我環顧四周,在草案3規範中沒有看到任何說格式可以或不可以是數組的格式。 https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23
然而,草案4明確指出格式必須是字符串。 http://json-schema.org/latest/json-schema-validation.html#anchor79
我正確地認爲Json.Net框架在這方面不是向後兼容嗎?或者,它在以前的版本中的工作方式是錯誤的?這將幫助我們相應地解決問題。謝謝。
你有一個缺少的閉合大括號? – 2015-02-18 00:00:58
@ nick-s是的,我喜歡。我已經糾正它,謝謝。 – Apeksha 2015-02-18 23:03:12