Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Api 在RAML中,是否有基于查询参数提供不同示例的方法_Api_Rest_Raml - Fatal编程技术网

Api 在RAML中,是否有基于查询参数提供不同示例的方法

Api 在RAML中,是否有基于查询参数提供不同示例的方法,api,rest,raml,Api,Rest,Raml,我想这个问题是不言自明的。我有一个名为expand的查询参数,当提供该参数时,将提供相关资源的嵌入式表示。否则,它将提供指向所述资源的链接。是否有一种方法可以基于RAML中的expand值提供这两个示例?RAML 1.0附带此支持,有关详细信息,请参阅RAML 1.0附带此支持,有关详细信息,请参阅RAML 1.0中的示例: /{songId}: get: responses: 200: body: applicat

我想这个问题是不言自明的。我有一个名为
expand
的查询参数,当提供该参数时,将提供相关资源的嵌入式表示。否则,它将提供指向所述资源的链接。是否有一种方法可以基于RAML中的
expand
值提供这两个示例?

RAML 1.0附带此支持,有关详细信息,请参阅RAML 1.0附带此支持,有关详细信息,请参阅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

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