krakenjs / generator-swaggerize

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

Generated handler sets a `501` status code and generated tests check for `200` status code #66

Closed subeeshcbabu-zz closed 7 years ago

subeeshcbabu-zz commented 8 years ago

The default status code set by the generated handler is 501 - Not Implemented. https://github.com/krakenjs/generator-swaggerize/blob/master/app/templates/_handler_express.js#L14 This status code makes sense because, it is up to the actual API implementor to provide the functionality here. However the tests generated by the generator checks for 200 status code and this makes the npm test on the generated application to fail by default. I think it would be useful if we could change the 501 status code to 200 (and Add a comment on complete the implementation details) so that the tests will not fail by default.

subeeshcbabu-zz commented 7 years ago

generator-swaggerize@3.0.0 generates handlers that uses Mock data generator by default. Mock data generator using swagmock generates responses based on the swagger spec.

Unit tests generates parameters and requests based on the swagger spec using swagmock module, so that the generated unit tests will be able to make sure that the API works end to end.