In a project I work on we use Checkstyle via the maven-checkstyle-plugin. We also use springdoc-openapi-ui, thus on the controllers we use the @ApiReponses annotation. It has a rather complex syntax, but it works well, so I wrote something like this on a controller:
@ApiResponses(value = {
@ApiResponse(description = "foo",
content = {
@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = UgyTableDataResponse.class)),
@Content(mediaType = MediaType.APPLICATION_XML_VALUE,
schema = @Schema(implementation = UgyTableDataResponse.class))
})
})
However both the @ApiResponse and @Content annotations are marked by Checkstyle with Checkstyle: 'annotation array initialization' child has incorrect indentation level 12, expected level should be 8.
I would like to change the Checkstyle settings so that I can keep the annotations in this well readable format.
The indentation settings in my checkstyle.xml are:
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
The plugin dependency in the POM is:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>