krakenjs / generator-swaggerize

Yeoman generator for design-driven apis with swagger 2.0 and krakenjs/swaggerize tools.
Other
70 stars 34 forks source link

Upgrade enjoi version #65

Closed subeeshcbabu-zz closed 8 years ago

subeeshcbabu-zz commented 8 years ago

swaggerize-express@^4 brings in "enjoi": "^1.0.0" https://github.com/krakenjs/generator-swaggerize/blob/master/app/templates/_package.json#L21 However the generated app's dev dependency on enjoi is stuck at an older version making the unit test fail. https://github.com/krakenjs/generator-swaggerize/blob/master/app/templates/_test_express.js#L59

grawk commented 8 years ago

What are we getting from enjoi@^1?

subeeshcbabu-zz commented 8 years ago

The generated app's unit test uses enjoi to validate the output schema of response.

https://github.com/krakenjs/generator-swaggerize/blob/master/app/templates/_test_express.js#L59

The older version of enjoi is breaking the unit tests.

This is basically a bug fix.

subeeshcbabu-zz commented 8 years ago

swaggerize-express@^4 brings in "enjoi": "^1.0.0" https://github.com/krakenjs/generator-swaggerize/blob/master/app/templates/_package.json#L21 However the generated app's dev dependency on enjoi is stuck at an older version making the unit test fail.

grawk commented 8 years ago

Right, but is there a feature or bug fix in 1.0 which we want specifically? Is this related to any open issues on this repo?

subeeshcbabu-zz commented 8 years ago

No bugs reported yet. I found this while testing the app create flow. Ah, Let me raise a bug for this first.

subeeshcbabu-zz commented 8 years ago

Linking the issue #68

grawk commented 8 years ago

:+1:

subeeshcbabu-zz commented 8 years ago

Found an issue with the Major version upgrade of enjoi. Interestingly unit tests of generator did not catch this issue.

The options structure changed as part of the enjoi version ^1. Now it expects a subSchemas property. https://github.com/tlivings/enjoi#api.

/swaggerize-examples/petstore-simple-express/node_modules/enjoi/lib/enjoi.js:25
        if (current.type) {
                   ^
TypeError: Cannot read property 'type' of undefined

Updated the PR with a fix for this.