From 558cd46a7c960588b4163ce64ef6a5d17e35a181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Mon, 30 Sep 2024 09:07:08 +0200 Subject: [PATCH] PMT-9: Add Generation of Employee API Client --- src/main/resources/api.yml => api/pmt.yml | 0 build.gradle.kts | 22 ++++++++++++++----- .../.codegen-ignore => gen/.ignore-pmt | 0 gen/config-employee.json | 11 ++++++++++ .../gen-config.json => gen/config-pmt.json | 0 5 files changed, 27 insertions(+), 6 deletions(-) rename src/main/resources/api.yml => api/pmt.yml (100%) rename src/main/resources/.codegen-ignore => gen/.ignore-pmt (100%) create mode 100644 gen/config-employee.json rename src/main/resources/gen-config.json => gen/config-pmt.json (100%) diff --git a/src/main/resources/api.yml b/api/pmt.yml similarity index 100% rename from src/main/resources/api.yml rename to api/pmt.yml diff --git a/build.gradle.kts b/build.gradle.kts index d8e2076..ad78b7f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ checkstyle { } spotbugs { - toolVersion = "4.8.6" + toolVersion = "4.8.6" effort.set(Effort.MAX) reportLevel.set(Confidence.LOW) } @@ -75,20 +75,27 @@ dependencies { swaggerSources { register("pmt") { - setInputFile(file("${rootDir}/src/main/resources/api.yml")) - code.configFile = file("${rootDir}/src/main/resources/gen-config.json") + setInputFile(file("${rootDir}/api/pmt.yml")) + code.configFile = file("${rootDir}/gen/config-pmt.json") val validationTask = validation code(delegateClosureOf { language = "spring" code.rawOptions = - listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath) + listOf("--ignore-file-override=" + file("${rootDir}/gen/.ignore-pmt").absolutePath) dependsOn(validationTask) }) } + create("employee") { + setInputFile(file("${rootDir}/api/employee.yml")) + code.configFile = file("${rootDir}/gen/config-employee.json") + code(delegateClosureOf { + language = "java" + }) + } } tasks { - + withType() withType { reports { xml.required.set(true) @@ -96,7 +103,6 @@ tasks { } } withType { - excludeFilter.set(file("${rootDir}/src/main/resources/spotbugs-exclude.xml")) } processResources { @@ -107,6 +113,7 @@ tasks { } named("compileJava").configure { dependsOn(swaggerSources.getByName("pmt").code) + dependsOn(swaggerSources.getByName("employee").code) } } @@ -114,5 +121,8 @@ sourceSets { main { java.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/java") resources.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/resources") + + java.srcDir("${swaggerSources.getByName("employee").code.outputDir}/src/main/java") + resources.srcDir("${swaggerSources.getByName("employee").code.outputDir}/src/main/resources") } } diff --git a/src/main/resources/.codegen-ignore b/gen/.ignore-pmt similarity index 100% rename from src/main/resources/.codegen-ignore rename to gen/.ignore-pmt diff --git a/gen/config-employee.json b/gen/config-employee.json new file mode 100644 index 0000000..8d96886 --- /dev/null +++ b/gen/config-employee.json @@ -0,0 +1,11 @@ +{ + "modelPackage": "de.hmmh.pmt.employee.dtos", + "apiPackage": "de.hmmh.pmt.employee.api", + "invokerPackage": "de.hmmh.pmt.employee", + "java8": false, + "java11": true, + "dateLibrary": "java11", + "library": "resttemplate", + "serializableModel": true, + "jakarta": true +} \ No newline at end of file diff --git a/src/main/resources/gen-config.json b/gen/config-pmt.json similarity index 100% rename from src/main/resources/gen-config.json rename to gen/config-pmt.json