Added tests and fix for issue #1392. Fix regex generated in Ruby client. (#1393)

* Added tests and fix for issue #1392. Param validation with regex not recognizing \d correctly in Ruby client.

* Added generated files to pass ./bin/utils/ensure-up-to-date which is run by circleci
This commit is contained in:
Guy Gershoni
2018-11-07 15:08:23 +11:00
committed by William Cheng
parent f21640f6a1
commit 0e2e1bf715
13 changed files with 340 additions and 13 deletions

View File

@@ -146,6 +146,23 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf
return name;
}
public String toRegularExpression(String pattern) {
if (StringUtils.isEmpty(pattern)) {
return pattern;
}
// We don't escape \ in string since Ruby doesn't like \ escaped in regex literal
String regexString = pattern;
if (!regexString.startsWith("/")) {
regexString = "/" + regexString;
}
if (StringUtils.countMatches(regexString, '/') == 1) {
// we only have forward slash inserted at start... adding one to end
regexString = regexString + "/";
}
return regexString;
}
@Override
public String toParamName(String name) {
// should be the same as variable name