Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodejs template: kebab-case component schema name creates invalid JavaScript #204

Open
laurence-myers opened this issue Feb 3, 2021 · 1 comment
Labels

Comments

@laurence-myers
Copy link

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) {
  // ...
}
@MikeRalphson
Copy link
Contributor

Note: look at interaction of variableNamingConvention and modelPropertyNaming and see if one should affect parameter naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants