2017-04-19 78 views
0

我想在多個文件中定義REST資源,並將其納入一個單一的錯構瘤文件 我試圖this但我總是錯構瘤的錯誤RAML 1.0包括與資源

Main.raml #%RAML 1.0 title: Main RAML file to include All APIs version: v1 baseUri: http://api.samplehost.com /student: !include student.raml

多個文件student.raml

#%RAML 1.0 title: student APIs version: v1 baseUri: http://api.samplehost.com /student: get: # ..etc

但我得到的包含文件未知錯誤:未知節點: '標題' 在Main.raml

當我從包含的文件「student.raml」 刪除「標題」我得到了在student.raml文件未知缺少必需的屬性「標題」

回答

0

我覺得it's不可能做到這一點與RAML。

對我來說,完成此問題的最佳方法是使用RAML庫,並使用資源類型,特徵和類型與要公開的路徑相關聯。請參閱RAML 1.0 documentation

+0

你能給我舉一個如何將類型關聯到路由的例子嗎? –

+0

這裏有很多例子:https://github.com/raml-apis –

0

raml-org issue,你student.raml文件應該是這樣的:

得到:

的重要組成部分,這裏除去第一線

#%RAML 1.0