PMT-19: In progress
Some checks failed
Quality Check / Linting (push) Failing after 1m31s
Quality Check / Static Analysis (push) Failing after 1m30s
Quality Check / Testing (push) Failing after 1m30s
Quality Check / Validate OAS (push) Successful in 4m17s

This commit is contained in:
Dominik Säume 2024-09-27 16:07:03 +02:00
parent 88c1b196b1
commit 4d5785cdab
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
3 changed files with 47 additions and 2 deletions

View file

@ -0,0 +1,6 @@
*
**/*
!**/pom.xml
!**/README.md
!**/.openapi-generator-ignore
!**/src/main/java/de/hmmh/**/*

View file

@ -2,6 +2,7 @@ import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
import org.openapitools.codegen.languages.JavaClientCodegen
repositories {
mavenCentral()
@ -14,6 +15,7 @@ plugins {
id("org.springframework.boot") version "3.3.3"
id("io.spring.dependency-management") version "1.1.6"
id("org.hidetake.swagger.generator") version "2.19.2"
id("org.openapi.generator") version "7.8.0"
}
checkstyle {
@ -87,6 +89,34 @@ swaggerSources {
}
}
openApiGenerate {
remoteInputSpec = "https://employee.szut.dev/v3/api-docs.yaml"
apiPackage = "ignored"
modelPackage = "ignored"
invokerPackage = "de.hmmh.pmt.employee"
groupId = "de.hmmh"
packageName = "de.hmmh.pmt"
generatorName = "java"
generateModelTests = false
generateApiTests = false
generateApiDocumentation = false
generateModelDocumentation = false
library = JavaClientCodegen.RESTTEMPLATE
ignoreFileOverride.set(".openapi-generator-java-sources.ignore")
configOptions.putAll(
mapOf(
JavaClientCodegen.GENERATE_CLIENT_AS_BEAN to "true",
JavaClientCodegen.ANNOTATION_LIBRARY to "swagger2",
JavaClientCodegen.OPENAPI_NULLABLE to "false",
JavaClientCodegen.PERFORM_BEANVALIDATION to "true",
JavaClientCodegen.USE_BEANVALIDATION to "true",
JavaClientCodegen.USE_JAKARTA_EE to "true",
)
)
}
tasks {
withType<Checkstyle> {
@ -101,12 +131,14 @@ tasks {
}
processResources {
dependsOn(generateSwaggerCode)
dependsOn(openApiGenerate)
}
withType<Test> {
useJUnitPlatform()
}
named("compileJava").configure {
dependsOn(swaggerSources.getByName("pmt").code)
dependsOn(openApiGenerate)
}
}
@ -114,5 +146,7 @@ sourceSets {
main {
java.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/java")
resources.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/resources")
java.srcDir("${openApiGenerate.outputDir}/src/main/java")
}
}

View file

@ -1,9 +1,11 @@
package de.hmmh.pmt;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.hmmh.pmt.employee.ApiClient;
import de.hmmh.pmt.oas.DefaultApi;
import de.hmmh.pmt.dtos.HelloOut;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -14,6 +16,9 @@ import java.util.Optional;
@RequestMapping("${openapi.projectManagement.base-path:/api/v1}")
public class ApiController implements DefaultApi {
@Autowired
private ApiClient apiClient;
@Override
public Optional<ObjectMapper> getObjectMapper() {
return Optional.empty();