mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 05:29:13 +00:00
Fix regexp in ruby-client (#1521)
* Fix regexp in ruby-client * Remove tests for unknown regexp patterns
This commit is contained in:
committed by
William Cheng
parent
9b99b6b6bf
commit
ebf67e683c
@@ -147,20 +147,7 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf
|
||||
}
|
||||
|
||||
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;
|
||||
return addRegularExpressionDelimiter(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user