PMT-2: Switch Generator Implementation to a more fitting one
Some checks failed
Quality Check / Static Analysis (push) Failing after 1m14s
Quality Check / Testing (push) Failing after 1m13s
Quality Check / Validate OAS (push) Successful in 1m26s
Quality Check / Linting (push) Failing after 1m48s

This commit is contained in:
Dominik Säume 2024-09-19 21:06:56 +02:00
parent fd6356517e
commit af6b251f74
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
4 changed files with 27 additions and 20 deletions

View file

@ -61,7 +61,7 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
//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")
}
@ -72,7 +72,7 @@ swaggerSources {
val validationTask = validation
code(delegateClosureOf<GenerateSwaggerCode> {
language = "spring"
components = listOf("models", "apis", "supportingFiles=ApiUtil.java")
components = listOf("models", "apis")
code.rawOptions =
listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath)
dependsOn(validationTask)

View file

@ -1,17 +1,31 @@
package de.hmmh.pmt;
import com.fasterxml.jackson.databind.ObjectMapper;
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.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Optional;
@Controller
@RequestMapping("${openapi.projectManagement.base-path:/api/v1}")
public class ApiController implements DefaultApi {
@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();
hello.setMsg("Hello World");
return ResponseEntity.ok(hello);

View file

@ -1,20 +1,13 @@
{
"library": "spring-boot",
"dateLibrary": "java8",
"hideGenerationTimestamp": true,
"modelPackage": "de.hmmh.pmt.oas",
"modelPackage": "de.hmmh.pmt.oas.models",
"apiPackage": "de.hmmh.pmt.oas",
"invokerPackage": "de.hmmh.pmt.oas",
"serializableModel": true,
"openApiNullable": false,
"useTags": true,
"useGzipFeature": true,
"unhandledException": true,
"useSpringBoot3": true,
"useSwaggerUI": true,
"importMappings": {
"ResourceSupport": "org.springframework.hateoas.RepresentationModel",
"Link": "org.springframework.hateoas.Link"
}
"java8": false,
"java11": true,
"dateLibrary": "java11",
"library": "spring-boot3",
"defaultInterfaces": false,
"hideGenerationTimestamp": true,
"serializableModel": true
}