danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 481 forks source link

TypeError when using `array[enum]` #236

Closed f440 closed 8 years ago

f440 commented 8 years ago

steps to reproduce

$ git clone https://gist.github.com/f440/dc7a954ee62c20d685e7 /tmp/aglio-test $ cd /tmp/aglio-test $ cat test.apib

FORMAT: 1A

# Notes API

## Note [/notes/{id}]
+ Attributes
    + tags (array[Tags])

### Retrieve a Note [GET]
+ Response 200 (application/json)
    + Attributes (Note)

# Data Structure

## Tags (enum)

- tips
- diary

$ npm install $ ./node_modules/.bin/aglio -v aglio 2.2.0 olio 1.6.2 $ ./node_modules/.bin/aglio -i test.apib -o test.html

/private/tmp/aglio-test/node_modules/aglio-theme-olio/lib/main.js:387
    ref = api.content || [];
             ^
TypeError: Cannot read property 'content' of undefined
    at decorate (/private/tmp/aglio-test/node_modules/aglio-theme-olio/lib/main.js:387:14)
    at Object.exports.render (/private/tmp/aglio-test/node_modules/aglio-theme-olio/lib/main.js:645:5)
    at /private/tmp/aglio-test/node_modules/aglio/lib/main.js:133:20
vvondra commented 8 years ago

You saved me a few more hours of tracking down the cause, thanks!

Is this same error message somehow related to https://github.com/danielgtaylor/aglio/issues/237 ?

f440 commented 8 years ago

drafter produce warning message by both This PR and #237.

$ drafter test.apib
element: "parseResult"
content:
  -
    element: "annotation"
    meta:
      classes:
        - "warning"
    attributes:
      code: 4
      sourceMap:
        -
          element: "sourceMap"
          content: []
    content: "ExtendElement must be composed from Elements of same type"

OK.
warning: (4)  ExtendElement must be composed from Elements of same type

So, it seems to me that aglio has no responsibility of this problem. I withdraw this PR. Thanks.