You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In DefaultCodegen.java the underscore method does not work with acronyms, initialisms, or any multi capital letter phrases. This is because these lines of code:
// Replace capital letter with _ plus lowercase letter.
word = word.replaceAll(firstPattern, replacementPattern);
word = word.replaceAll(secondPattern, replacementPattern);
are designed to add an underscore before each capital letter (ignoring the first letter). For example, SomeIDs would be converted to some_i_ds instead of some_ids.
I discovered this bug while generating a Python client but presumably this issue exists in other languages.
Swagger-codegen version
2.4.0.SNAPSHOT up to date with PR 8748 (September 26th).
The standard python client generation command will produce this bug.
Steps to reproduce
Generate Python Client from Swagger schema containing an acronym, initialisms, or any multi capital letter phrases
Look at corresponding name in Python client.
Related issues/PRs
Suggest a fix/enhancement
Changing the logic to place the underscores at the end of a series of capital letters instead of after each capital letter will solve this issue.
The text was updated successfully, but these errors were encountered:
This is copied over from swagger-codegen project as it exists in openapi-generator code also. This is the originally reported issue;
--------------------------copied over-------------------------------------
Description
In DefaultCodegen.java the underscore method does not work with acronyms, initialisms, or any multi capital letter phrases. This is because these lines of code:
are designed to add an underscore before each capital letter (ignoring the first letter). For example, SomeIDs would be converted to some_i_ds instead of some_ids.
I discovered this bug while generating a Python client but presumably this issue exists in other languages.
Swagger-codegen version
2.4.0.SNAPSHOT up to date with PR 8748 (September 26th).
Swagger declaration file content or url
A model class similar to:
in a Swagger schema will produce the bug.
Command line used for generation
The standard python client generation command will produce this bug.
Steps to reproduce
Generate Python Client from Swagger schema containing an acronym, initialisms, or any multi capital letter phrases
Look at corresponding name in Python client.
Related issues/PRs
Suggest a fix/enhancement
Changing the logic to place the underscores at the end of a series of capital letters instead of after each capital letter will solve this issue.
The text was updated successfully, but these errors were encountered: