PMT-19: In progress
This commit is contained in:
parent
88c1b196b1
commit
4d5785cdab
3 changed files with 47 additions and 2 deletions
6
.openapi-generator-java-sources.ignore
Normal file
6
.openapi-generator-java-sources.ignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
*
|
||||||
|
**/*
|
||||||
|
!**/pom.xml
|
||||||
|
!**/README.md
|
||||||
|
!**/.openapi-generator-ignore
|
||||||
|
!**/src/main/java/de/hmmh/**/*
|
|
@ -2,6 +2,7 @@ import com.github.spotbugs.snom.Confidence
|
||||||
import com.github.spotbugs.snom.Effort
|
import com.github.spotbugs.snom.Effort
|
||||||
import com.github.spotbugs.snom.SpotBugsTask
|
import com.github.spotbugs.snom.SpotBugsTask
|
||||||
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
|
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
|
||||||
|
import org.openapitools.codegen.languages.JavaClientCodegen
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -14,6 +15,7 @@ plugins {
|
||||||
id("org.springframework.boot") version "3.3.3"
|
id("org.springframework.boot") version "3.3.3"
|
||||||
id("io.spring.dependency-management") version "1.1.6"
|
id("io.spring.dependency-management") version "1.1.6"
|
||||||
id("org.hidetake.swagger.generator") version "2.19.2"
|
id("org.hidetake.swagger.generator") version "2.19.2"
|
||||||
|
id("org.openapi.generator") version "7.8.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
checkstyle {
|
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 {
|
tasks {
|
||||||
|
|
||||||
withType<Checkstyle> {
|
withType<Checkstyle> {
|
||||||
|
@ -101,12 +131,14 @@ tasks {
|
||||||
}
|
}
|
||||||
processResources {
|
processResources {
|
||||||
dependsOn(generateSwaggerCode)
|
dependsOn(generateSwaggerCode)
|
||||||
|
dependsOn(openApiGenerate)
|
||||||
}
|
}
|
||||||
withType<Test> {
|
withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
named("compileJava").configure {
|
named("compileJava").configure {
|
||||||
dependsOn(swaggerSources.getByName("pmt").code)
|
dependsOn(swaggerSources.getByName("pmt").code)
|
||||||
|
dependsOn(openApiGenerate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,5 +146,7 @@ sourceSets {
|
||||||
main {
|
main {
|
||||||
java.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/java")
|
java.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/java")
|
||||||
resources.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/resources")
|
resources.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/resources")
|
||||||
|
|
||||||
|
java.srcDir("${openApiGenerate.outputDir}/src/main/java")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package de.hmmh.pmt;
|
package de.hmmh.pmt;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import de.hmmh.pmt.employee.ApiClient;
|
||||||
import de.hmmh.pmt.oas.DefaultApi;
|
import de.hmmh.pmt.oas.DefaultApi;
|
||||||
import de.hmmh.pmt.dtos.HelloOut;
|
import de.hmmh.pmt.dtos.HelloOut;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -14,6 +16,9 @@ import java.util.Optional;
|
||||||
@RequestMapping("${openapi.projectManagement.base-path:/api/v1}")
|
@RequestMapping("${openapi.projectManagement.base-path:/api/v1}")
|
||||||
public class ApiController implements DefaultApi {
|
public class ApiController implements DefaultApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ObjectMapper> getObjectMapper() {
|
public Optional<ObjectMapper> getObjectMapper() {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|
Loading…
Reference in a new issue