bootprint / bootprint-openapi

Bootprint-module to render OpenAPI specifications, this repository has moved to https://github.com/bootprint/bootprint-monorepo/tree/master/packages/bootprint-openapi
MIT License
357 stars 48 forks source link

Better Error messages #41

Closed fxdgear closed 9 years ago

fxdgear commented 9 years ago

I'm getting an error message, but it doesn't help me understand where in the document the problem is.

$ # bootprint swagger swagger.json /docs/target
Loading bootprint-swagger 0.9.2
Loading bootprint-json-schema 0.7.1
Loading bootprint-base 0.5.1
[TypeError: Cannot read property 'minimum' of undefined]
/usr/local/lib/node_modules/bootprint/node_modules/q/q.js:155
                throw e;
                ^

TypeError: Cannot read property 'minimum' of undefined
    at module.exports.json-schema--range (/usr/local/lib/node_modules/bootprint-swagger/node_modules/bootprint-json-schema/handlebars/helpers.js:52:27)
    at wrapper (/usr/local/lib/node_modules/bootprint/node_modules/lodash/index.js:3533:19)
    at Object.eval (eval at createFunctionContext (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:221:23), <anonymous>:11:130)
    at ret (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/runtime.js:159:30)
    at ret (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:488:21)
    at Object.invokePartial (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/runtime.js:218:12)
    at Object.invokePartialWrapper [as invokePartial] (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/runtime.js:61:39)
    at Object.eval (eval at createFunctionContext (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:221:23), <anonymous>:14:23)
    at ret (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/runtime.js:159:30)
    at ret (/usr/local/lib/node_modules/bootprint/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:488:21)
nknapp commented 9 years ago

As far as I can see, it's a bug in bootprint-json-schema (which bootprint-swagger depends on). It happened to me with a definition that had an { "type": "array" } without an items-property. I have just released bootprint-json-schema@0.7.2. Try to update your bootprint-swagger and make sure that it uses the new version of bootprint-json-schema.

Let me know if that solved your problem.