From bdb51d67209ccd9e95a4b612c0f22a5580dc73bf Mon Sep 17 00:00:00 2001 From: Rob Vesse Date: Tue, 21 May 2019 09:28:51 +0100 Subject: [PATCH] Dump parser warnings at startup When starting up Inflector if there are any warning messages emitted by the parser dump them to as WARN level log messages so that users actually see them --- .../io/swagger/oas/inflector/OpenAPIInflector.java | 10 +++++++++- 1 file changed, 9 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 64e96392..5882dfce 100644 --- a/src/main/java/io/swagger/oas/inflector/OpenAPIInflector.java +++ b/src/main/java/io/swagger/oas/inflector/OpenAPIInflector.java @@ -117,8 +117,16 @@ protected void init(Configuration configuration) { options.setResolve(true); options.setResolveFully(true); SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser().readLocation(config.getSwaggerUrl(), null, options); + + // Dump any warning messages the parser might produce + if (!swaggerParseResult.getMessages().isEmpty()) { + for (String message : swaggerParseResult.getMessages()) { + LOGGER.warn(message); + } + } + OpenAPI openAPI = swaggerParseResult.getOpenAPI(); - + if(!config.getValidatePayloads().isEmpty()) { LOGGER.info("resolving openAPI"); new ExtensionsUtil().addExtensions(openAPI);