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

securedBY: [null] produces error #159

Closed cdanderson closed 8 years ago

cdanderson commented 8 years ago

I have a resource defined as such:

/ping:
  get:
    securedBy: [null]
    description: Responds with an appropriate HTTP status code & message for the state of the API.
    responses:
      200:
        body:
          application/json:
            example:
              !include examples/ping.json

I'm using raml2html, but parsing my RAML file results in the following error message:

Error parsing: Template render error: (/usr/local/lib/node_modules/raml2html/lib/template.nunjucks)
  Template render error: (/usr/local/lib/node_modules/raml2html/lib/resource.nunjucks) [Line 65, Column 64]
  TypeError: Cannot read property '0' of undefined

Removing securedBy: [null] allows the file to be parsed correctly.

dmartinezg commented 8 years ago

I don't think this is an RAML parser issue, this works for me:

#%RAML 0.8
title: Foo
/ping:
  get:
    securedBy: [null]
    description: Responds with an appropriate HTTP status code & message for the state of the API.
blakeembrey commented 8 years ago

@cdanderson You should look at logging it on raml2html as the error is from https://github.com/kevinrenskers/raml2html/blob/master/lib/resource.nunjucks#L65 - I'd guess that it's not handling null and trying to do something specifically with the assumption of strings.

cdanderson commented 8 years ago

Thanks for your comments. I've closed the issue here and will investigate further.