Skip to content

Commit ef3d4c8

Browse files
committed
#20 - OpenAPI (swagger) generation produces path "//:id" (for merged root path case)
1 parent b27d2ab commit ef3d4c8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/java/io/dinject/javalin/generator/MethodReader.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import static io.dinject.javalin.generator.Constants.JAVALIN2_ROLES;
2424
import static io.dinject.javalin.generator.Constants.JAVALIN3_ROLES;
25+
import static io.dinject.javalin.generator.Util.combinePath;
2526
import static io.dinject.javalin.generator.Util.typeDef;
2627

2728
public class MethodReader {
@@ -53,8 +54,6 @@ public class MethodReader {
5354

5455
private String fullPath;
5556

56-
private PathSegments segments;
57-
5857
MethodReader(ControllerReader bean, ExecutableElement element, ExecutableType actualExecutable, ProcessingContext ctx) {
5958
this.ctx = ctx;
6059
this.bean = bean;
@@ -136,10 +135,10 @@ void addRoute(Append writer) {
136135

137136
if (webMethod != null) {
138137

139-
fullPath = Util.combinePath(beanPath, webMethodPath);
140-
segments = PathSegments.parse(fullPath);
138+
PathSegments segments = PathSegments.parse(combinePath(beanPath, webMethodPath));
139+
fullPath = segments.fullPath();
141140

142-
writer.append(" ApiBuilder.%s(\"%s\", ctx -> {", webMethod.name().toLowerCase(), segments.fullPath()).eol();
141+
writer.append(" ApiBuilder.%s(\"%s\", ctx -> {", webMethod.name().toLowerCase(), fullPath).eol();
143142
writer.append(" ctx.status(%s);", getStatusCode()).eol();
144143

145144
List<PathSegments.Segment> metricSegments = segments.metricSegments();

0 commit comments

Comments
 (0)