From 6685cc1262bb3e80c7780a3c4786ebcdb2da1906 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 8 Feb 2021 11:54:10 +0100 Subject: [PATCH] fix #3868 - maven plugin: use prettyPrint from config file --- .../main/java/io/swagger/v3/plugin/maven/SwaggerMojo.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/swagger-maven-plugin/src/main/java/io/swagger/v3/plugin/maven/SwaggerMojo.java b/modules/swagger-maven-plugin/src/main/java/io/swagger/v3/plugin/maven/SwaggerMojo.java index 855a13ca0c..fb99da9998 100644 --- a/modules/swagger-maven-plugin/src/main/java/io/swagger/v3/plugin/maven/SwaggerMojo.java +++ b/modules/swagger-maven-plugin/src/main/java/io/swagger/v3/plugin/maven/SwaggerMojo.java @@ -83,9 +83,9 @@ public void execute() throws MojoExecutionException, MojoFailureException { OpenApiContext context = builder.buildContext(true); OpenAPI openAPI = context.read(); - if (StringUtils.isNotBlank(filterClass)) { + if (StringUtils.isNotBlank(config.getFilterClass())) { try { - OpenAPISpecFilter filterImpl = (OpenAPISpecFilter) this.getClass().getClassLoader().loadClass(filterClass).newInstance(); + OpenAPISpecFilter filterImpl = (OpenAPISpecFilter) this.getClass().getClassLoader().loadClass(config.getFilterClass()).newInstance(); SpecFilter f = new SpecFilter(); openAPI = f.filter(openAPI, filterImpl, new HashMap<>(), new HashMap<>(), new HashMap<>()); @@ -98,14 +98,14 @@ public void execute() throws MojoExecutionException, MojoFailureException { String openapiJson = null; String openapiYaml = null; if (Format.JSON.equals(outputFormat) || Format.JSONANDYAML.equals(outputFormat)) { - if (prettyPrint != null && prettyPrint) { + if (config.isPrettyPrint() != null && config.isPrettyPrint()) { openapiJson = context.getOutputJsonMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openAPI); } else { openapiJson = context.getOutputJsonMapper().writeValueAsString(openAPI); } } if (Format.YAML.equals(outputFormat) || Format.JSONANDYAML.equals(outputFormat)) { - if (prettyPrint != null && prettyPrint) { + if (config.isPrettyPrint() != null && config.isPrettyPrint()) { openapiYaml = context.getOutputYamlMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openAPI); } else { openapiYaml = context.getOutputYamlMapper().writeValueAsString(openAPI);