使用Spray.IO,我正在構建一個接收JSON輸入的服務。 我想通過檢查一些字段來驗證JSON有效負載。Spray.io驗證json指令
我沒有興趣在驗證JSON模式或解析錯誤,但檢查的字段值,而不是像真正的字段的類型(如:整數VS浮動)
我沒有興趣使用Scala的要求,因爲這會引發異常,並且不會通知客戶端所有在單個請求中發現驗證錯誤。
這是否有內置指令/拒絕?
我在Play中看到過類似的東西(http://www.playframework.com/documentation/2.2.1/ScalaJsonRequests),如果沒有內置的東西,我將如何去建立自己的東西?
謝謝@Gangstead爲你的答案。我剛剛編輯了我的問題,因爲我意識到你可能是一種有效的方法,但我會在我的請求中遺漏所有其他驗證錯誤。 – Roman