Skip to content

Commit 14a8e95

Browse files
Prevent replacing path names with the same name as a dynamic path parameter
1 parent 47c0a58 commit 14a8e95

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
427427
String axumPath = op.path;
428428
for (CodegenParameter param : op.pathParams) {
429429
// Replace {baseName} with {paramName} for format string
430-
axumPath = axumPath.replace(param.baseName, param.paramName);
430+
String paramSearch = "{" + param.baseName + "}";
431+
String paramReplace = "{" + param.paramName + "}";
432+
433+
axumPath = axumPath.replace(paramSearch, paramReplace);
431434
}
432435
pathMethodOpMap
433436
.computeIfAbsent(axumPath, (key) -> new ArrayList<>())

0 commit comments

Comments
 (0)