Skip to content

Commit 881ceb3

Browse files
authored
Merge pull request #3874 from swagger-api/ticket-3868
fix #3868 - maven plugin: use prettyPrint from config file
2 parents daf8213 + 6685cc1 commit 881ceb3

File tree

1 file changed

+4
-4
lines changed
  • modules/swagger-maven-plugin/src/main/java/io/swagger/v3/plugin/maven

1 file changed

+4
-4
lines changed

modules/swagger-maven-plugin/src/main/java/io/swagger/v3/plugin/maven/SwaggerMojo.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public void execute() throws MojoExecutionException, MojoFailureException {
8383
OpenApiContext context = builder.buildContext(true);
8484
OpenAPI openAPI = context.read();
8585

86-
if (StringUtils.isNotBlank(filterClass)) {
86+
if (StringUtils.isNotBlank(config.getFilterClass())) {
8787
try {
88-
OpenAPISpecFilter filterImpl = (OpenAPISpecFilter) this.getClass().getClassLoader().loadClass(filterClass).newInstance();
88+
OpenAPISpecFilter filterImpl = (OpenAPISpecFilter) this.getClass().getClassLoader().loadClass(config.getFilterClass()).newInstance();
8989
SpecFilter f = new SpecFilter();
9090
openAPI = f.filter(openAPI, filterImpl, new HashMap<>(), new HashMap<>(),
9191
new HashMap<>());
@@ -98,14 +98,14 @@ public void execute() throws MojoExecutionException, MojoFailureException {
9898
String openapiJson = null;
9999
String openapiYaml = null;
100100
if (Format.JSON.equals(outputFormat) || Format.JSONANDYAML.equals(outputFormat)) {
101-
if (prettyPrint != null && prettyPrint) {
101+
if (config.isPrettyPrint() != null && config.isPrettyPrint()) {
102102
openapiJson = context.getOutputJsonMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openAPI);
103103
} else {
104104
openapiJson = context.getOutputJsonMapper().writeValueAsString(openAPI);
105105
}
106106
}
107107
if (Format.YAML.equals(outputFormat) || Format.JSONANDYAML.equals(outputFormat)) {
108-
if (prettyPrint != null && prettyPrint) {
108+
if (config.isPrettyPrint() != null && config.isPrettyPrint()) {
109109
openapiYaml = context.getOutputYamlMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openAPI);
110110
} else {
111111
openapiYaml = context.getOutputYamlMapper().writeValueAsString(openAPI);

0 commit comments

Comments
 (0)