PMT-2: Switch Generator Implementation to a more fitting one
This commit is contained in:
parent
fd6356517e
commit
af6b251f74
4 changed files with 27 additions and 20 deletions
|
@ -61,7 +61,7 @@ dependencies {
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
|
|
||||||
//OAS
|
//OAS
|
||||||
swaggerCodegen("org.openapitools:openapi-generator-cli:7.8.0")
|
swaggerCodegen("io.swagger.codegen.v3:swagger-codegen-cli:3.0.61")
|
||||||
implementation("io.swagger.core.v3:swagger-annotations:2.2.22")
|
implementation("io.swagger.core.v3:swagger-annotations:2.2.22")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ swaggerSources {
|
||||||
val validationTask = validation
|
val validationTask = validation
|
||||||
code(delegateClosureOf<GenerateSwaggerCode> {
|
code(delegateClosureOf<GenerateSwaggerCode> {
|
||||||
language = "spring"
|
language = "spring"
|
||||||
components = listOf("models", "apis", "supportingFiles=ApiUtil.java")
|
components = listOf("models", "apis")
|
||||||
code.rawOptions =
|
code.rawOptions =
|
||||||
listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath)
|
listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath)
|
||||||
dependsOn(validationTask)
|
dependsOn(validationTask)
|
||||||
|
|
|
@ -1,17 +1,31 @@
|
||||||
package de.hmmh.pmt;
|
package de.hmmh.pmt;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import de.hmmh.pmt.oas.DefaultApi;
|
import de.hmmh.pmt.oas.DefaultApi;
|
||||||
import de.hmmh.pmt.oas.HelloOut;
|
import de.hmmh.pmt.oas.models.HelloOut;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
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;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("${openapi.projectManagement.base-path:/api/v1}")
|
@RequestMapping("${openapi.projectManagement.base-path:/api/v1}")
|
||||||
public class ApiController implements DefaultApi {
|
public class ApiController implements DefaultApi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<HelloOut> getHello() throws Exception {
|
public Optional<ObjectMapper> getObjectMapper() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<HttpServletRequest> getRequest() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<HelloOut> getHello() {
|
||||||
HelloOut hello = new HelloOut();
|
HelloOut hello = new HelloOut();
|
||||||
hello.setMsg("Hello World");
|
hello.setMsg("Hello World");
|
||||||
return ResponseEntity.ok(hello);
|
return ResponseEntity.ok(hello);
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
{
|
{
|
||||||
"library": "spring-boot",
|
"modelPackage": "de.hmmh.pmt.oas.models",
|
||||||
"dateLibrary": "java8",
|
|
||||||
"hideGenerationTimestamp": true,
|
|
||||||
"modelPackage": "de.hmmh.pmt.oas",
|
|
||||||
"apiPackage": "de.hmmh.pmt.oas",
|
"apiPackage": "de.hmmh.pmt.oas",
|
||||||
"invokerPackage": "de.hmmh.pmt.oas",
|
"invokerPackage": "de.hmmh.pmt.oas",
|
||||||
"serializableModel": true,
|
"java8": false,
|
||||||
"openApiNullable": false,
|
"java11": true,
|
||||||
"useTags": true,
|
"dateLibrary": "java11",
|
||||||
"useGzipFeature": true,
|
"library": "spring-boot3",
|
||||||
"unhandledException": true,
|
"defaultInterfaces": false,
|
||||||
"useSpringBoot3": true,
|
"hideGenerationTimestamp": true,
|
||||||
"useSwaggerUI": true,
|
"serializableModel": true
|
||||||
"importMappings": {
|
|
||||||
"ResourceSupport": "org.springframework.hateoas.RepresentationModel",
|
|
||||||
"Link": "org.springframework.hateoas.Link"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue