Open ColeMurray opened 2 years ago
@wing328, it looks like you're the original author of the line in question (and most of the template, thanks 🙌 ). Can you clarify if there is a reason that underscore is not included in the pattern here? If not, fix seems to be adding back underscore / removing the override all together.
Bug Report Checklist
Description
When generating a service, nodejs-express-server incorrectly names properties that have underscores in the name.
Expected: userId Actual: userUnderscoreid
openapi-generator version
5.4.0
OpenAPI declaration file content or url
Generation Details
openapi-generator generate -i api-spec.yaml --package-name service -g nodejs-express-server -o ~/workplace/service
UsersService.ts
Steps to reproduce
See above
Related issues/PRs
N/A
Suggest a fix
Utilize camelize when creating property names.
The root cause appears to be here, where underscore is not included in the pattern, where it is in the normal default.: https://github.com/OpenAPITools/openapi-generator/blob/b6a8037f62a5e4244236b65518c9f5e6fd02f27e/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSExpressServerCodegen.java#L414
https://github.com/OpenAPITools/openapi-generator/blob/b6a8037f62a5e4244236b65518c9f5e6fd02f27e/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L5359
Which then causes underscore to be renamed by special characters in this block here: https://github.com/OpenAPITools/openapi-generator/blob/b6a8037f62a5e4244236b65518c9f5e6fd02f27e/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L1484