Search code examples
apirestraml

Describing URI parameters in RAML


I'm declaring a REST service API stub in RAML. My web application provides equipment, which can be listed, obtained by id or by code. When I want the whole list, I don't specify any URI parameter, however, to get a concrete equipment, I do. That's its current state:

/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

Here, in description fields I write what the current call performs. However, I would like to add a description for the parameter passed in the URI itself (id or code). Is there a way to achieve it?


Solution

  • You are missing uriParameters sections to describe the equipmentId and code parameters. In such section, you can specify the usual: type, description...

    See section Template URIs and URI Parameters in the spec: https://github.com/raml-org/raml-spec/blob/master/versions/raml-08/raml-08.md#template-uris-and-uri-parameters