We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d58d44 commit 4477009Copy full SHA for 4477009
modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java
@@ -196,8 +196,10 @@ public String toDefaultValue(Property p) {
196
197
@Override
198
public String toVarName(String name) {
199
- // replace - with _ e.g. created-at => created_at
200
- name = name.replaceAll("-", "_");
+ // remove trailing special characters, e.g. "post[created-at]!!" => "post[created-at"
+ name = name.replaceAll("\\W+\\z", "");
201
+ // replace special characters with _, e.g. "post[created-at" => "post_created_at"
202
+ name = name.replaceAll("\\W+", "_");
203
204
// if it's all uppper case, convert to lower case
205
if (name.matches("^[A-Z_]*$")) {
0 commit comments