add Swagger module

This commit is contained in:
2024-08-29 13:19:07 +10:00
parent 78438ce3d0
commit 9ca50f5eff
4 changed files with 111 additions and 0 deletions

55
pom.xml Normal file
View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>sydney.cheng</groupId>
<artifactId>ec-super-pom</artifactId>
<version>1.0.1</version>
</parent>
<artifactId>ec-microservice-commons</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<licenses>
<license>
<name>MIT License</name>
<url>https://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<developers>
<developer>
<name>Edward Cheng</name>
<email>edward@cheng.sydney</email>
<organization>cheng.sydney</organization>
<organizationUrl>https://3dwardch3ng.github.io/</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/3dwardch3ng/ec-microservice-commons.git</connection>
<developerConnection>scm:git:ssh://github.com:3dwardch3ng/ec-microservice-commons.git</developerConnection>
<url>https://github.com/3dwardch3ng/ec-microservice-commons/tree/main</url>
</scm>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/3dwardch3ng/ec-microservice-commons/issues</url>
</issueManagement>
<modules>
<module>swagger</module>
</modules>
<properties>
<!-- Sonar Properties -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.xmlReportPath>${project.basedir}/../target/site/jacoco/jacoco.xml</sonar.jacoco.xmlReportPath>
<sonar.language>java</sonar.language>
<sonar.coverage.exclusions>**/config/*</sonar.coverage.exclusions>
<sonar.organization>3dwardch3ng</sonar.organization>
<sonar.host.url>https://sonarqube.cluster.edward.sydney</sonar.host.url>
</properties>
</project>

32
swagger/pom.xml Normal file
View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>sydney.cheng</groupId>
<artifactId>ec-microservice-commons</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>cheng.edward</groupId>
<artifactId>ec-microservice-commons-swagger</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<!-- Dependency Versions -->
<springdoc-openapi-starter-common.version>2.6.0</springdoc-openapi-starter-common.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId>
<version>${springdoc-openapi-starter-common.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,17 @@
package cheng.edward.microservice.commons.swagger.config;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import org.springframework.context.annotation.Configuration;
@Configuration
@OpenAPIDefinition(info = @Info(title = "MediRecords Secure Message API", version = "v1"))
@SecurityScheme(
name = "Authentication Token",
type = SecuritySchemeType.HTTP,
scheme = "bearer"
)
public class SwaggerConfiguration {
}

View File

@@ -0,0 +1,7 @@
package cheng.edward.microservice.commons.swagger.controller;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@SecurityRequirement(name = "Authentication Token")
public interface SecuredController {
}