raml-org / raml-js-parser

(deprecated) A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.
195 stars 53 forks source link

Parser does not include description of high-level uri parameter. #186

Open vikclickz opened 7 years ago

vikclickz commented 7 years ago

Consider the following raml document

/play:
  get:
      description: Get a collection of <<resourcePathName>>.
     responses:
        200:
            body:
                schema: <<resourcePathName>>
                example: <<get-example>>
  post:
       description: Creates a <<resourcePathName | !singularize>>.
       body:
           schema: <<resourcePathName | !singularize>>
           example: <<post-example>>
       responses:
             201:
                description: Successfully created the resource.
   /{first}:
       uriParameters:
          first:
            description: |
                 first parameter
            type: string
       get:
           description: Get a collection of <<resourcePathName>>.
          responses:
               200:
                   body:
                        schema: <<resourcePathName>>
                        example: <<get-example>>
           /subresource:
               get:
                  description: Get a collection of <<resourcePathName>>.
                 responses:
                      200:
                           body:
                                schema: <<resourcePathName>>
                                example: <<get-example>>
                    /{second}:
                        uriParameters:
                        second:
                         description: |
                                second parameter
                                type: string
                       get:
                         description: Get a collection of <<resourcePathName>>.
                         responses:
                         200:
                              body:
                                   schema: <<resourcePathName>>
                                   example: <<get-example>>

so the url for the for the innermost resource resolves to /play/{first}/subresource/{second}

In this case, the parser does not pick-up the description of the higher level uri parameter and include it in the uri parameter description of the {second} resource.

Also, if I try to manually add the description of the {first} uri parameter in the uriParameter description of the {second} resource in the raml itself, the parser throws a validation error: error validating baseUri, first uri parameter unused.

eg:

          /{second}:
               uriParameters:
               first:
                 description: |
                      first parameter
                      type: string
               second:
                   description: |
                        second parameter
                        type: string

Version : 0.8.11