1

我想这个问题是不言自明的。我有一个名为的查询参数expand,如果提供该参数,它将提供相关资源的嵌入式表示。否则,它会提供指向所述资源的链接。有没有办法根据expandRAML 中的值提供这两个示例?

4

2 回答 2

3

RAML 1.0 附带此支持,有关详细信息,请参阅https://github.com/raml-org/raml-spec/issues/107

于 2014-10-07T19:59:36.410 回答
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
于 2015-11-09T23:45:14.490 回答