openapi-codegen
openapi-codegen copied to clipboard
nodejs template: kebab-case component schema name creates invalid JavaScript
e.g.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/foo-bar-baz'
The generate API files have code like this:
module.exports.do_foo = function do_foo (req, res, next) {
var foo-bar-baz = req.swagger.params['foo-bar-baz'].value;
// ...
}
-
is not a valid identifier character in JavaScript, because it's used as a mathematic operator foo - bar - baz
.
The identifier is also used in the generated impl/API service:
exports.do_foo = function(foo-bar-baz) {
// ...
}
Note: look at interaction of variableNamingConvention
and modelPropertyNaming
and see if one should affect parameter naming.