我想这个问题非常明显。我有一个名为expand
的查询参数,当提供时,它将提供相关资源的嵌入表示。否则,它提供指向所述资源的链接。有没有办法根据RAML中expand
的值提供这两个示例?
答案 0 :(得分:3)
RAML 1.0附带此支持,有关详细信息,请参阅https://github.com/raml-org/raml-spec/issues/107
答案 1 :(得分:1)
RAML 1.0中的一个例子:
/{songId}:
get:
responses:
200:
body:
application/json:
type: object
properties:
title: string
description?: string
artist:
type: object
properties:
name: string
is_band: boolean
examples:
song1:
description: Example for a song without description and the artist is not a band.
content:
title: Yesterday
artist:
name: The Beatles
is_band: true
song2:
description: Example for a song with description and the artist is a band.
content:
title: How deep is your love
description: That could be a description for the song.
artist:
name: Calvin Harris
is_band: false