add core view extension with JTE and Thymeleaf support

This commit is contained in:
Relism
2026-04-21 00:32:09 +02:00
parent 34fd74068a
commit 9e19f439be
93 changed files with 2200 additions and 1404 deletions
@@ -344,7 +344,11 @@ public final class OpenApiBuilder {
}
private static String normalizePath(String path) {
return path.startsWith("/") ? path : "/" + path;
String normalized = path.startsWith("/") ? path : "/" + path;
while (normalized.startsWith("//")) {
normalized = normalized.substring(1);
}
return normalized;
}
private static String defaultDescription(int status) {
@@ -108,6 +108,21 @@ class OpenApiExtensionTest {
assertFalse(paths.containsKey("/users"));
}
@Test
void normalizes_double_slash_paths_from_events() {
FlashContext ctx = new FlashContext();
OpenApiExtension ext = new OpenApiExtension();
ext.provide(ctx);
emitRoute(ctx, HttpMethod.GET, "//blogs", "/", ScopedUsersHandler.class);
OpenApiBuilder builder = ctx.require(OpenApiBuilder.class);
Map<String, Object> spec = builder.build();
Map<String, Object> paths = cast(spec.get("paths"));
assertTrue(paths.containsKey("/blogs"));
assertFalse(paths.containsKey("//blogs"));
}
@SuppressWarnings("unchecked")
private static List<RouteListener> listeners(FlashContext ctx) {
try {