This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Identify a free port for the spring boot integration test phase --> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>build-helper-maven-plugin</artifactId> | |
<version>3.2.0</version> | |
<executions> | |
<execution> | |
<id>reserve-tomcat-port</id> | |
<goals><goal>reserve-network-port</goal></goals> | |
<phase>process-resources</phase> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.springdoc</groupId> | |
<artifactId>springdoc-openapi-maven-plugin</artifactId> | |
<version>1.1</version> | |
<executions> | |
<execution> | |
<id>integration-test</id> | |
<goals> | |
<goal>generate</goal> | |
</goals> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
springdoc.writer-with-default-pretty-printer=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OpenAPIDefinition( | |
info = @Info( | |
title = "API Roundtrip Demo (viadee.de)", | |
description = "An API showcase demonstrating how to automatically generate an openapi spec and client based on this.", | |
version = "0.1.0", | |
contact = @Contact( | |
name = "Cloud @viadee", | |
url = "https://www.viadee.de", | |
email = "[email protected]"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springdoc</groupId> | |
<artifactId>springdoc-openapi-ui</artifactId> | |
<version>1.5.4</version> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
public class UserApiController implements UserApi { | |
private Map<String, User> users = new HashMap<>(); | |
@Override | |
public List<User> findAll() { | |
return new ArrayList<>(users.values()); | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/api/users") | |
@Tag(name = "User API", description = "User Management API") | |
interface UserApi { | |
@GetMapping | |
@ResponseStatus(code = HttpStatus.OK) | |
List<User> findAll(); | |
@GetMapping("/{id}") | |
@ResponseStatus(code = HttpStatus.OK) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ArchTest | |
private static ArchRule controllers_should_be_suffixed = | |
freeze( | |
classes() | |
.that().areAnnotatedWith(RestController.class) | |
.should().haveSimpleNameEndingWith("Controller") | |
.andShould().resideInAPackage("..controller..") | |
.because("controllers must use business services instead of the persistence layer") | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AnalyzeClasses( | |
packages = " de.viadee.architecture.archunit", | |
importOptions = { | |
ImportOption.DoNotIncludeTests.class, | |
ImportOption.DoNotIncludeJars.class, | |
ImportOption.DoNotIncludeArchives.class }) | |
public class MyTest { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<!-- Note: deactivate debug logs for ArchUnit to prevent OutOfMemory errors on windows terminals. --> | |
<include resource="org/springframework/boot/logging/logback/defaults.xml"/> | |
<include resource="org/springframework/boot/logging/logback/console-appender.xml" /> | |
<root level="INFO"> | |
<appender-ref ref="CONSOLE" /> | |
</root> | |
<logger name="com.tngtech.archunit" level="WARN"/> | |
</configuration> |