我有两个RAML文件(必须是v0.8),完全描述了两个资源: animals.raml和plants.raml。
它们都包含如下内容:
#%RAML 0.8
---
title: Animals API
baseUri: http://something/
documentation:
- title: Overview
content: The */animals* resource allows you to...
mediaType: application/json
protocols:
- HTTPS
/animals:
post:
description: Create a new animal
body:
schema: !include ./schemas/animal.schema.json
responses:
202:
description: In a few months, your new pet will be born.现在我想要一个主文件,api.raml,它将提供有关动植物资源的一般概述。API读取器将导航到api.raml,从那里他将能够再次导航到特定的raml。也可以是内联的,在同一页上。
我天真地尝试了
#%RAML 0.8
---
title: Zoo & Botanical garden APIs
documentation:
- title: Overview
content: The *Zoo & Botanical garden APIs* contain resources that allow you to ...
resourceTypes: !include animals.raml
resourceTypes: !include plants.raml显然很天真,失败了,很多关于标题元素的抱怨和其他的抱怨。
我应该如何创建主api.raml,它基本上只需要包含一个通用信息,然后包含/链接到特定的RAML?
发布于 2018-02-09 16:37:20
不能使用"resourceTypes:“关键字两次,您可以将资源类型分开如下:
#%RAML 0.8
title: Example API
version: v1
resourceTypes:
- collection: !include resourceTypes/collection.raml
- member: !include resourceTypes/member.raml或者将所有内容都包含在一个文件中,然后这样做:
#%RAML 0.8
title: Example API
version: v1
resourceTypes: !include resourceTypes.ramlhttps://stackoverflow.com/questions/48708848
复制相似问题