天天看點

Raml些許細節

raml的schema中可以定義屬性是否為required

  • 對于一個response來說,raml并不會強制規範傳回的實際資料必須如schema聲明的一樣required
  • 在一次輸入中,raml會嚴格根據schema的規範來限制實際傳入的資料
  • 當schema本身required為false,屬性required為true時,傳入對象不能為空
  • schema=false, 屬性=false,傳入對象可以為空
  • schema=true,屬性=false,對象也可為空

raml由raml-jaxrs插件生成java api之資料類型對應表

raml java
integer Integer
string String
null Object
number Double(在非json中定義的number,會轉換為BigDecimal)
array List
boolean Boolean
file File
date java.util.Date