Closed rickhaffey closed 8 years ago
Isn't, defining the dependency as ^1.0.0
, going to give you the latest 1.0.2 version?
You're right.
Looking into it a bit more, I see now why I wasn't getting the 1.0.2 version.
I've been using generator-swaggerize to build out the initial scaffolding, by calling yo swaggerize
. After watching npm pull down all the references, I've then been calling npm start
without an intermediate call to npm install
. (I've been working on the understanding that the yeoman template installed all the necessary packages for me...)
Looking into generator-swaggerize's package.json, I'm seeing the following:
"dependencies": {
"enjoi": "^0.2.0",
I'll close this PR and create a new one to update that reference in generator-swaggerize to ^1.0.0
.
Nice. The PR to update the dependent module versions to latest is already open - https://github.com/krakenjs/generator-swaggerize/pull/57
I updated the enjoi reference from version 1.0.0 to 1.0.2.
I was running into problems within the call to
validator:make()
in cases where the swagger spec contains $ref schemas on in-body parameters.It's due to the validator.js code expecting the 1.0.2 version enjoi constructor (which takes an
options
object), but the reference to enjoi 1.0.0 instead providing a constructor that takes asubschemas
object.https://github.com/Fanatics/swaggerize-routes/blob/master/lib/validator.js#L83
https://github.com/tlivings/enjoi/blob/401467bf7aef14352f29d713392ab694f2618d7a/lib/enjoi.js#L7