在RAML中描述URI参数

时间:2014-09-23 14:47:07

标签: api rest raml

我在 RAML 中声明了一个REST服务API存根。我的Web应用程序提供了可以列出的设备,可以通过id或代码获得。当我想要整个列表时,我没有指定任何URI参数,但是,为了获得具体设备,我这样做。这是它目前的状态:

/equipment:
    get:
      body:
        application/json:
        application/xml:
    description:
      List all the equipment
    /id/{equipmentId}:
      get:
         body:
          application/json:
          application/xml:
      description:
        Get an equipment by id 
    /code/{code}:
        get:
          body:
            application/json:
            application/xml:
        description: 
              Get an equipment by code

description字段中,我写了当前调用执行的内容。但是,我想为URI本身(idcode)中传递的参数添加说明。有没有办法实现它?

1 个答案:

答案 0 :(得分:7)

您缺少uriParameters个部分来描述equipmentIdcode参数。在此类版块中,您可以指定常用内容:typedescription ...

请参阅规范中的模板URI和URI参数部分:https://github.com/raml-org/raml-spec/blob/master/versions/raml-08/raml-08.md#template-uris-and-uri-parameters

相关问题