Skip to content

Commit 98b726a

Browse files
authored
Merge pull request #222 from SentryMan/path-enum
Fix Enum Path Parsing
2 parents d7a9678 + 100c85a commit 98b726a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

http-generator-core/src/main/java/io/avaje/http/generator/core/TypeMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ static class EnumHandler extends ObjectHandler {
310310

311311
@Override
312312
public String toMethod() {
313-
return "(" + type.shortType() + ") asEnum(" + type.shortType() + ".class,";
313+
return "(" + type.shortType() + ") asEnum(" + type.shortType() + ".class, ";
314314
}
315315

316316
@Override
317317
public String asMethod() {
318-
return "java.util.Objects.toString(";
318+
return "(" + type.shortType() + ") asEnum(" + type.shortType() + ".class, ";
319319
}
320320
}
321321

tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/test/TestController2.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ String enumQueryImplied(String s, @QueryParam ServerType type) {
4343
return type.name();
4444
}
4545

46+
@Post("/enumPath/{type}")
47+
String enumPath(ServerType type) {
48+
return type.name();
49+
}
50+
4651
@Get("/mapTest")
4752
String mapTest(Map<String, List<String>> strings) {
4853
return strings.toString();

0 commit comments

Comments
 (0)