fsbahman / apidoc-swagger

apidoc and swagger are two nice projects which are focusing on documentation of APIs. This project is a middle tier which tries to bring them together in a sense that it uses apidoc to convert inline documentation to json schema and later convert it to swagger json schmea.
Other
252 stars 129 forks source link

Using @apiParamExample breaks swagger.json generation #18

Open folderol4 opened 8 years ago

folderol4 commented 8 years ago

Example apidoc:

/**
 * @api {post} /stuff Create a new stuff
 * @apiName createStuff
 * @apiGroup createStuffGroup
 *
 * @apiSampleRequest http://localhost:17443/stuff
 *
 * @apiParamExample {json} Post-Example: set stuff
 *    {
 *       "name": "stuff"
 *    }
 *
 */

Causes this issue: error: Cannot read property 'Parameter' of undefined debug: TypeError: Cannot read property 'Parameter' of undefined at createPathParameters (/stuff/node_modules/apidoc-swagger/lib/apidocToSwagger.js:275:45) at createPostPushPutOutput (/stuff/node_modules/apidoc-swagger/lib/apidocToSwagger.js:76:19) at extractPaths (/stuff/node_modules/apidoc-swagger/lib/apidocToSwagger.js:62:19) at Object.toSwagger (/stuff/node_modules/apidoc-swagger/lib/apidocToSwagger.js:13:18) at Object.createApidocSwagger (/stuff/node_modules/apidoc-swagger/lib/index.js:107:63) at Object. (/stuff/node_modules/apidoc-swagger/bin/apidocSwagger.js:143:19) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12)

cxolast commented 8 years ago

I have seem problem, but no crash. Params from @apiParamExample not isset in swagger.json