mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 07:19:16 +00:00
* 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:
committed by
William Cheng
parent
f21640f6a1
commit
0e2e1bf715
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user