Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

model parsing issue #12

Closed
b3ll4t0r opened this issue Nov 11, 2014 · 5 comments
Closed

model parsing issue #12

b3ll4t0r opened this issue Nov 11, 2014 · 5 comments
Labels

Comments

@b3ll4t0r
Copy link

undefined:47
            body = models[param.schema.$ref.slice(param.schema.$ref.lastIndexO
                                                                    ^
TypeError: Cannot call method 'lastIndexOf' of undefined
    at eval (eval at template (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/node_modules/lodash/dist/lodash.js:6305:22), <anonymous>:47:77)
    at Function.forEach (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/node_modules/lodash/dist/lodash.js:3297:15)
    at eval (eval at template (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/node_modules/lodash/dist/lodash.js:6305:22), <anonymous>:29:15)
    at Function.forEach (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/node_modules/lodash/dist/lodash.js:3297:15)
    at eval (eval at template (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/node_modules/lodash/dist/lodash.js:6305:22), <anonymous>:16:3)
    at underscore [as _engine] (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/lib/util/engines.js:32:30)
    at engine (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/lib/actions/actions.js:303:10)
    at template (/usr/local/lib/node_modules/generator-swaggerize/node_modules/yeoman-generator/lib/actions/actions.js:281:15)
    at /usr/local/lib/node_modules/generator-swaggerize/app/index.js:347:18
    at Array.forEach (native)
@tlivings
Copy link
Contributor

Yeah, this assumes you are using $ref from you body's schema definition. The reason for this is that models are generated from the api document's definitions section (by convention used for models in Swagger).

If you don't have a definitions section for models, then the generator won't create models for them, and the tests won't know how to stub data.

@MattiSG
Copy link
Contributor

MattiSG commented Nov 24, 2014

If it wontfix, perhaps should it be closed? :)

@aredridel
Copy link
Contributor

Also it could be robust to this and not just bomb.

@tlivings
Copy link
Contributor

Yeah will be adding more robust checks in general. Added wontfix tag to indicate that the root cause won't be fixed.

@subeeshcbabu-zz
Copy link
Member

Closing as per #62

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants