From b6a978f09ab7fed3188760c6b66025e3f3bee162 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 6 Jan 2020 08:32:36 -0800 Subject: [PATCH] construct the debug path correctly with and without swaggerBase --- .../io/swagger/oas/inflector/OpenAPIInflector.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/swagger/oas/inflector/OpenAPIInflector.java b/src/main/java/io/swagger/oas/inflector/OpenAPIInflector.java index 97dedb89..33e57c9b 100644 --- a/src/main/java/io/swagger/oas/inflector/OpenAPIInflector.java +++ b/src/main/java/io/swagger/oas/inflector/OpenAPIInflector.java @@ -358,7 +358,17 @@ protected void init(Configuration configuration) { } } final Resource.Builder builder = Resource.builder(); - builder.path(basePath(originalBasePath, config.getSwaggerBase() + "debug.json")) + String debugPath; + + if(config.getSwaggerBase().endsWith("/")) { + debugPath = basePath(originalBasePath, config.getSwaggerBase() + "debug.json"); + } + else { + debugPath = basePath(originalBasePath, config.getSwaggerBase() + "/debug.json"); + } + + LOGGER.debug("using debug path: `" + debugPath + "`"); + builder.path(debugPath) .addMethod(HttpMethod.GET) .produces(MediaType.APPLICATION_JSON) .handledBy(new InflectResultController(result))