Description
Description
Using the code search engine in, lgtm.com various toVarName or toParamName methods does not seem to have properly escaped special characters:
https://lgtm.com/query/2023430003/project:12070014/lang:java/
The above shows methods toVarName and toParamName that do not call sanitizeName. Not all of these are problematic, as special characters may have been escaped in another way, but some of them needs fixing. In particular, in the case of c++, this can lead to uncompilable code.
Swagger-codegen version
master branch: cbd7301
Swagger declaration file content or url
e.g. For cpp.
Command line used for generation
Steps to reproduce
java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -l cpprest -i cpp.yaml -o ./test
Suggest a Fix
I will create a PR for the c++ case, but perhaps others can take a look at the other languages to see if it is ok. Once a method is found to be correct, I can update the query to exclude it (or others can take a look at the docs https://lgtm.com/docs/ql/primer/ql-primer). Once everything is either fixed or excluded, we can close the issue. Note: The link posted to the query result is cached for the commit cbd7301 and will require updating from time to time. To do so, copy the content of the query console on the page, enter swagger-api/swagger-codegen in the search box, then click 'Query this project' on the right, paste back the content to the console and click run once it is compiled.