2017-04-19 80 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