3.1簡化數據模型ui
經過可重用定義來重構出現有重複定義的文檔spa
eg.當在文檔中屢次出現關於person的定義時code
required: - username properties: firstName: type: string lastName: type: string username: type: string
將關於重複出現的person定義抽取出來
definitions: #添加定義項
Person:
required: - username properties: firstName: type: string lastName: type: string username: type: string須要用到這個定義時,用$ref屬性來引用便可$ref:"#/definition/Person" #引用一個定義來增長另外一個定義