Skip to content

Commit 15fc1f5

Browse files
committed
refactor: introduce shared regex patterns for improved code readability
1 parent 28e7026 commit 15fc1f5

50 files changed

Lines changed: 297 additions & 178 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
8787
private static final Pattern JAVA_UTIL_IMPORT = Pattern.compile("java\\.util\\.(List|ArrayList|Map|HashMap)");
8888
private static final Pattern STARTS_WITH_UNDERSCORE_CLASS = Pattern.compile("^_*class$");
8989
private static final Pattern ANNOTATION_IN_TYPE = Pattern.compile("(?:(?i)@[a-z0-9]*+([(].*[)]|\\s*))*+");
90-
private static final Pattern NON_ALPHANUMERIC = Pattern.compile("\\P{Alnum}");
90+
private static final Pattern NON_ALPHANUMERIC_UNICODE = Pattern.compile("\\P{Alnum}");
9191
private static final Pattern INVALID_PACKAGE_CHARS = Pattern.compile("[^a-zA-Z0-9_.]");
9292

9393
public static final String DEFAULT_LIBRARY = "<default>";
@@ -2003,8 +2003,8 @@ public String removeAnnotations(String dataType) {
20032003
*/
20042004
public String sanitizeDataType(String dataType) {
20052005
String content = removeAnnotations(dataType);
2006-
if (content != null && NON_ALPHANUMERIC.matcher(content).find()) {
2007-
content = NON_ALPHANUMERIC.matcher(content).replaceAll("");
2006+
if (content != null && NON_ALPHANUMERIC_UNICODE.matcher(content).find()) {
2007+
content = NON_ALPHANUMERIC_UNICODE.matcher(content).replaceAll("");
20082008
}
20092009
return content;
20102010
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractRustCodegen.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
import java.math.BigInteger;
1515
import java.util.*;
1616
import java.util.function.Function;
17+
import java.util.regex.Pattern;
1718

1819
import static org.openapitools.codegen.utils.StringUtils.*;
1920

2021
public abstract class AbstractRustCodegen extends DefaultCodegen implements CodegenConfig {
2122

2223
private final Logger LOGGER = LoggerFactory.getLogger(AbstractRustCodegen.class);
2324

25+
/** Matches hyphens and periods — replaced with underscores during name sanitisation. */
26+
private static final Pattern HYPHEN_OR_PERIOD = Pattern.compile("[.\\-]");
27+
2428
protected static final String VENDOR_EXTENSION_PARAM_IDENTIFIER = "x-rust-param-identifier";
2529

2630
protected List<String> charactersToAllow = Collections.singletonList("_");
@@ -184,7 +188,7 @@ public String sanitizeIdentifier(String name, CasingType casingType, String esca
184188
}
185189

186190
// Replace hyphens and periods with underscores
187-
name = name.replaceAll("[\\.\\-]", "_");
191+
name = HYPHEN_OR_PERIOD.matcher(name).replaceAll("_");
188192

189193
// Apply special character escapes, e.g. "@type" => "At_type"
190194
// Remove the trailing underscore if necessary

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.io.StringWriter;
3838
import java.io.Writer;
3939
import java.util.*;
40+
import java.util.regex.Pattern;
4041

4142
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
4243
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
@@ -47,6 +48,11 @@
4748
public abstract class AbstractScalaCodegen extends DefaultCodegen {
4849
private final Logger LOGGER = LoggerFactory.getLogger(AbstractScalaCodegen.class);
4950

51+
/** Matches a valid Java/Scala identifier starting with a letter, {@code _} or {@code $}. */
52+
private static final Pattern SCALA_IDENTIFIER = Pattern.compile("[a-zA-Z_$][\\w_$]+");
53+
/** Matches a string consisting only of digits (possibly empty). */
54+
private static final Pattern DIGITS_ZERO_OR_MORE = Pattern.compile("[0-9]*");
55+
5056
// https://spec.openapis.org/registry/format/date-time-local.html
5157
protected static final String DATE_TIME_LOCAL_FORMAT = "date-time-local";
5258

@@ -288,7 +294,7 @@ public String toVarName(String name) {
288294
}
289295

290296
// if it's all upper case, do nothing
291-
if (!varName.matches("^[A-Z_0-9]*$")) {
297+
if (!ALL_UPPER_UNDERSCORE_DIGITS.matcher(varName).matches()) {
292298
varName = getNameUsingModelPropertyNaming(varName);
293299
}
294300

@@ -531,13 +537,13 @@ protected String formatIdentifier(String name, boolean capitalized) {
531537
if (capitalized) {
532538
identifier = StringUtils.capitalize(identifier);
533539
}
534-
if (identifier.matches("[a-zA-Z_$][\\w_$]+") && !isReservedWord(identifier)) {
540+
if (SCALA_IDENTIFIER.matcher(identifier).matches() && !isReservedWord(identifier)) {
535541
return identifier;
536542
}
537543

538544
// below code block only for scala-sttp4-jsoniter for backward copmatibility
539545
if (this instanceof ScalaSttp4JsoniterClientCodegen) {
540-
if (identifier.matches("[0-9]*")) {
546+
if (DIGITS_ZERO_OR_MORE.matcher(identifier).matches()) {
541547
return escapeReservedWord(identifier);
542548
}
543549
if (!capitalized || StringUtils.isNumeric(name)) {

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979

8080
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
8181

82+
/** Splits a composed TypeScript type string on {@code |}, {@code &}, {@code <}, or {@code >}. */
83+
private static final Pattern COMPOSED_TYPE_DELIMITERS = Pattern.compile("[|&<>]");
84+
/** Matches NPM versions that end with {@code -SNAPSHOT}. */
85+
private static final Pattern SNAPSHOT_VERSION = Pattern.compile("^.*-SNAPSHOT$");
86+
8287
/**
8388
* Help generating code for any kind of URL parameters (path, matrix, query).
8489
* <p>
@@ -491,7 +496,7 @@ public Map<String, String> toModelImportMap(String name) {
491496
}
492497

493498
private String[] splitComposedType(String name) {
494-
return name.replace(" ", "").split("[|&<>]");
499+
return COMPOSED_TYPE_DELIMITERS.split(name.replace(" ", ""));
495500
}
496501

497502
private boolean isUnionType(String name) {
@@ -526,7 +531,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
526531
}
527532

528533
if (additionalProperties.containsKey(SNAPSHOT) && Boolean.parseBoolean(additionalProperties.get(SNAPSHOT).toString())) {
529-
if (npmVersion.toUpperCase(Locale.ROOT).matches("^.*-SNAPSHOT$")) {
534+
if (SNAPSHOT_VERSION.matcher(npmVersion.toUpperCase(Locale.ROOT)).matches()) {
530535
this.setNpmVersion(npmVersion + "." + SNAPSHOT_SUFFIX_FORMAT.get().format(new Date()));
531536
} else {
532537
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.get().format(new Date()));

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/BashClientCodegen.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
5858

5959
protected static int emptyMethodNameCounter = 0;
6060

61+
// --- Precompiled patterns for markdown-to-bash conversion ---
62+
private static final java.util.regex.Pattern MD_BOLD_STAR = java.util.regex.Pattern.compile("(?m)(^|\\s)\\*{2}([\\w ]+)\\*{2}($|\\s)");
63+
private static final java.util.regex.Pattern MD_BOLD_UNDERSCORE = java.util.regex.Pattern.compile("(?m)(^|\\s)_{2}([\\w ]+)_{2}($|\\s)");
64+
private static final java.util.regex.Pattern MD_ITALIC_STAR = java.util.regex.Pattern.compile("(?m)(^|\\s)\\*([\\w ]+)\\*($|\\s)");
65+
private static final java.util.regex.Pattern MD_ITALIC_UNDER = java.util.regex.Pattern.compile("(?m)(^|\\s)_([\\w ]+)_($|\\s)");
66+
private static final java.util.regex.Pattern MD_H1 = java.util.regex.Pattern.compile("(?m)^#\\s+(.+)$");
67+
private static final java.util.regex.Pattern MD_H2 = java.util.regex.Pattern.compile("(?m)^##\\s+(.+)$");
68+
private static final java.util.regex.Pattern MD_H3 = java.util.regex.Pattern.compile("(?m)^###\\s+(.+)$");
69+
private static final java.util.regex.Pattern MD_CODE_BACKTICK = java.util.regex.Pattern.compile("(?m)\\s*```.*$");
70+
private static final java.util.regex.Pattern MD_CODE_QUOTE = java.util.regex.Pattern.compile("(?m)\\s*'''.*$");
71+
private static final java.util.regex.Pattern MD_TRAILING_WS = java.util.regex.Pattern.compile("\\s+$");
72+
6173
public static final String CURL_OPTIONS = "curlOptions";
6274
public static final String PROCESS_MARKDOWN = "processMarkdown";
6375
public static final String SCRIPT_NAME = "scriptName";
@@ -510,56 +522,45 @@ public String escapeText(String input) {
510522
* Convert markdown strong **Bold text** and __Bold text__
511523
* to bash bold control sequences (tput bold)
512524
*/
513-
result = result.replaceAll("(?m)(^|\\s)\\*{2}([\\w\\d ]+)\\*{2}($|\\s)",
514-
"\\$\\(tput bold\\) $2 \\$\\(tput sgr0\\)");
525+
result = MD_BOLD_STAR.matcher(result).replaceAll("\\$\\(tput bold\\) $2 \\$\\(tput sgr0\\)");
526+
result = MD_BOLD_UNDERSCORE.matcher(result).replaceAll("\\$\\(tput bold\\) $2 \\$\\(tput sgr0\\)");
515527

516-
result = result.replaceAll("(?m)(^|\\s)_{2}([\\w\\d ]+)_{2}($|\\s)",
517-
"\\$\\(tput bold\\) $2 \\$\\(tput sgr0\\)");
518528
/**
519529
* Convert markdown *Italics text* and _Italics text_ to bash dim
520530
* control sequences (tput dim)
521531
*/
522-
result = result.replaceAll("(?m)(^|\\s)\\*{1}([\\w\\d ]+)\\*{1}($|\\s)",
523-
"\\$\\(tput dim\\) $2 \\$\\(tput sgr0\\)");
524-
525-
result = result.replaceAll("(?m)(^|\\s)_{1}([\\w\\d ]+)_{1}($|\\s)",
526-
"\\$\\(tput dim\\) $2 \\$\\(tput sgr0\\)");
532+
result = MD_ITALIC_STAR.matcher(result).replaceAll("\\$\\(tput dim\\) $2 \\$\\(tput sgr0\\)");
533+
result = MD_ITALIC_UNDER.matcher(result).replaceAll("\\$\\(tput dim\\) $2 \\$\\(tput sgr0\\)");
527534

528535

529536
/**
530537
* Convert all markdown section 1 level headers with bold
531538
*/
532-
result = result.replaceAll("(?m)^\\#\\s+(.+)$",
533-
"\n\\$\\(tput bold\\)\\$\\(tput setaf 7\\)"
534-
+ "$1\\$\\(tput sgr0\\)");
539+
result = MD_H1.matcher(result).replaceAll("\n\\$\\(tput bold\\)\\$\\(tput setaf 7\\)"
540+
+ "$1\\$\\(tput sgr0\\)");
535541

536542
/**
537543
* Convert all markdown section 2 level headers with bold
538544
*/
539-
result = result.replaceAll("(?m)^\\#\\#\\s+(.+)$",
540-
"\n\\$\\(tput bold\\)\\$\\(tput setaf 7\\)"
541-
+ "$1\\$\\(tput sgr0\\)");
545+
result = MD_H2.matcher(result).replaceAll("\n\\$\\(tput bold\\)\\$\\(tput setaf 7\\)"
546+
+ "$1\\$\\(tput sgr0\\)");
542547

543548
/**
544549
* Convert all markdown section 3 level headers with bold
545550
*/
546-
result = result.replaceAll("(?m)^\\#\\#\\#\\s+(.+)$",
547-
"\n\\$\\(tput bold\\)\\$\\(tput setaf 7\\)"
548-
+ "$1\\$\\(tput sgr0\\)");
551+
result = MD_H3.matcher(result).replaceAll("\n\\$\\(tput bold\\)\\$\\(tput setaf 7\\)"
552+
+ "$1\\$\\(tput sgr0\\)");
549553

550554
/**
551555
* Convert all markdown code blocks into --- delimited sections
552556
*/
553-
result = result.replaceAll("(?m)\\s*```.*$",
554-
"\n---");
555-
556-
result = result.replaceAll("(?m)\\s*\\'\\'\\'.*$",
557-
"\n---");
557+
result = MD_CODE_BACKTICK.matcher(result).replaceAll("\n---");
558+
result = MD_CODE_QUOTE.matcher(result).replaceAll("\n---");
558559

559560
/**
560561
* Remove any trailing new line at the end of the string
561562
*/
562-
result = result.replaceAll("\\s+$", "");
563+
result = MD_TRAILING_WS.matcher(result).replaceAll("");
563564
}
564565

565566
return result;
@@ -583,7 +584,7 @@ public String escapeUnsafeCharacters(String input) {
583584
/**
584585
* Replace backticks with normal single quotes.
585586
*/
586-
String result = input.replaceAll("`", "'");
587+
String result = input.replace("`", "'");
587588

588589
return result;
589590
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import java.io.File;
3939
import java.util.*;
40+
import java.util.regex.Pattern;
4041

4142
import static org.openapitools.codegen.utils.StringUtils.dashize;
4243
import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -63,6 +64,9 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
6364

6465
protected String sourceFolder = "src";
6566

67+
private static final Pattern NON_ALPHA_UNDERSCORE_PLUS = Pattern.compile("[^a-zA-Z_]+");
68+
private static final Pattern NON_ALPHANUMERIC_UNDERSCORE_HYPHEN_PLUS = Pattern.compile("[^a-zA-Z0-9_-]+");
69+
6670
public ClojureClientCodegen() {
6771
super();
6872

@@ -306,7 +310,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
306310

307311
@Override
308312
public String sanitizeTag(String tag) {
309-
return tag.replaceAll("[^a-zA-Z_]+", "_");
313+
return NON_ALPHA_UNDERSCORE_PLUS.matcher(tag).replaceAll("_");
310314
}
311315

312316
@Override
@@ -359,7 +363,7 @@ public String toVarName(String name) {
359363
return nameMapping.get(name);
360364
}
361365

362-
name = name.replaceAll("[^a-zA-Z0-9_-]+", ""); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
366+
name = NON_ALPHANUMERIC_UNDERSCORE_HYPHEN_PLUS.matcher(name).replaceAll(""); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
363367
return name;
364368
}
365369

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppHttplibServerCodegen.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@
7979
public class CppHttplibServerCodegen extends AbstractCppCodegen {
8080
private final Logger LOGGER = LoggerFactory.getLogger(CppHttplibServerCodegen.class);
8181

82+
/** Matches a string that consists entirely of uppercase ASCII letters. */
83+
private static final java.util.regex.Pattern CPP_ALL_UPPER = java.util.regex.Pattern.compile("[A-Z]+");
84+
/** Matches a camelCase boundary for inserting a space separator. */
85+
private static final java.util.regex.Pattern CPP_CAMEL_BOUNDARY = java.util.regex.Pattern.compile("([a-z])([A-Z])");
86+
/** Matches the last digit-only part of a name after an underscore (e.g. {@code _2} in {@code method_2}). */
87+
private static final java.util.regex.Pattern CPP_TRAILING_DIGIT_PART = java.util.regex.Pattern.compile("\\d+");
88+
/** Matches a split point at a camelCase boundary OR any non-alphanumeric character. */
89+
private static final java.util.regex.Pattern CPP_CAMEL_SPLIT = java.util.regex.Pattern.compile("(?<=[a-z0-9])(?=[A-Z])|[^a-zA-Z0-9]");
90+
/** Matches one or more consecutive non-word-and-non-hyphen separators (spaces, underscores, etc.) in a name. */
91+
private static final java.util.regex.Pattern CPP_WORD_SEPARATORS = java.util.regex.Pattern.compile("[_\\-\\s]+");
92+
8293
@Override
8394
public void preprocessOpenAPI(OpenAPI openAPI) {
8495
super.preprocessOpenAPI(openAPI);
@@ -1315,9 +1326,9 @@ private void processModelVariable(CodegenProperty var, CodegenModel model) {
13151326
}
13161327
} else {
13171328
// Explicit default value from schema - use qualified enum name
1318-
String defaultVal = var.defaultValue.replaceAll("\"", "");
1329+
String defaultVal = var.defaultValue.replace("\"", "");
13191330
// Convert numeric enum values (e.g., "100" -> "_100")
1320-
if (defaultVal.matches("^[0-9]+$")) {
1331+
if (DIGITS_ONLY.matcher(defaultVal).matches()) {
13211332
defaultVal = "_" + defaultVal;
13221333
}
13231334
// Convert to UPPERCASE to match enum definition
@@ -1435,7 +1446,7 @@ public String toModelName(String name) {
14351446
// Try to extract a number suffix for uniqueness
14361447
if (name.contains("_")) {
14371448
String[] parts = name.split("_");
1438-
if (parts.length > 1 && parts[parts.length - 1].matches("\\d+")) {
1449+
if (parts.length > 1 && CPP_TRAILING_DIGIT_PART.matcher(parts[parts.length - 1]).matches()) {
14391450
return "InlineModel" + parts[parts.length - 1];
14401451
}
14411452
}
@@ -1838,7 +1849,7 @@ private Map<String, String> stripPathFromClassName(String path) {
18381849
}
18391850

18401851
// Split by "/", "_", "-", " ", camelCase boundary
1841-
String[] segments = clean.split("(?<=[a-z0-9])(?=[A-Z])|[^a-zA-Z0-9]");
1852+
String[] segments = CPP_CAMEL_SPLIT.split(clean);
18421853
List<String> parts = new ArrayList<>();
18431854
for (String seg : segments) {
18441855
if (seg != null && !seg.trim().isEmpty()) {
@@ -1940,9 +1951,9 @@ public String toPascalCase(String name) {
19401951
}
19411952

19421953
// First, insert spaces before uppercase letters to split camelCase
1943-
String normalized = name.replaceAll("([a-z])([A-Z])", "$1 $2");
1954+
String normalized = CPP_CAMEL_BOUNDARY.matcher(name).replaceAll("$1 $2");
19441955
// Split on delimiters (hyphens, underscores, spaces)
1945-
String[] parts = normalized.split("[_\\-\\s]+");
1956+
String[] parts = CPP_WORD_SEPARATORS.split(normalized);
19461957
StringBuilder result = new StringBuilder();
19471958
for (String part : parts) {
19481959
if (part != null && !part.isEmpty()) {
@@ -2020,7 +2031,7 @@ public String camelize(String name, boolean lowercaseFirstLetter) {
20202031
}
20212032

20222033
// If the result is the same as input and input is all uppercase,
2023-
if (result.equals(name) && name.equals(name.toUpperCase(Locale.ROOT)) && name.matches("[A-Z]+")) {
2034+
if (result.equals(name) && name.equals(name.toUpperCase(Locale.ROOT)) && CPP_ALL_UPPER.matcher(name).matches()) {
20242035
// Handle all-caps words manually
20252036
result = name.substring(0, 1).toUpperCase(Locale.ROOT) + name.substring(1).toLowerCase(Locale.ROOT);
20262037
if (lowercaseFirstLetter) {
@@ -2041,7 +2052,7 @@ public String camelize(String name, boolean lowercaseFirstLetter) {
20412052
public String toHandlerFunctionName(String httpMethod, String path, Boolean prefix) {
20422053
String method = toPascalCase(httpMethod);
20432054
String className = stripPathFromClassName(path).get("className");
2044-
className = className.replaceAll("[^A-Za-z0-9]", "");
2055+
className = NON_ALPHANUMERIC_CHAR.matcher(className).replaceAll("");
20452056
if (prefix) {
20462057
return "handle" + method + "For" + toPascalCase(className);
20472058
} else {
@@ -2057,7 +2068,7 @@ public String toHandlerFunctionName(String httpMethod, String path, Boolean pref
20572068
*/
20582069
public String toHandlerFunctionRequest(String path, String method) {
20592070
String className = stripPathFromClassName(path).get("className");
2060-
className = className.replaceAll("[^A-Za-z0-9]", "");
2071+
className = NON_ALPHANUMERIC_CHAR.matcher(className).replaceAll("");
20612072
return toPascalCase(className + toPascalCase(method) + "Request");
20622073
}
20632074

@@ -2070,7 +2081,7 @@ public String toHandlerFunctionRequest(String path, String method) {
20702081
*/
20712082
public String toHandlerFunctionResponse(String path, String method) {
20722083
String className = stripPathFromClassName(path).get("className");
2073-
className = className.replaceAll("[^A-Za-z0-9]", "");
2084+
className = NON_ALPHANUMERIC_CHAR.matcher(className).replaceAll("");
20742085
return toPascalCase(className + toPascalCase(method) + "Response");
20752086
}
20762087

@@ -2374,7 +2385,7 @@ private void convertNumericEnumValues(CodegenProperty property) {
23742385
String enumValStr = enumVal != null ? enumVal.toString() : "";
23752386
String convertedVal = enumValStr;
23762387
// Convert numeric values to have underscore prefix
2377-
if (enumValStr.matches("^[0-9]+$")) {
2388+
if (DIGITS_ONLY.matcher(enumValStr).matches()) {
23782389
convertedVal = "_" + enumValStr;
23792390
}
23802391
// Convert to UPPERCASE for C++ enum standards (clang style)
@@ -2457,7 +2468,7 @@ private void setEnumVendorExtensions(Object varObj, CodegenModel model) {
24572468
for (String enumVal : enumValues) {
24582469
// Convert numeric values to words or keep string values as-is
24592470
String convertedVal = enumVal;
2460-
if (enumVal.matches("^[0-9]+$")) {
2471+
if (DIGITS_ONLY.matcher(enumVal).matches()) {
24612472
// Convert number to enum name
24622473
convertedVal = "_" + enumVal; // Prefix with underscore for numeric values
24632474
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
276276
List<CodegenOperation> operationList = operations.getOperation();
277277
for (CodegenOperation op : operationList) {
278278
if (op.path != null) {
279-
op.path = op.path.replaceAll("\\{(.*?)\\}", ":$1");
279+
op.path = PATH_PARAMETER.matcher(op.path).replaceAll(":$1");
280280
}
281281
}
282282
return objs;

0 commit comments

Comments
 (0)