Added backend and fixed openapi generation
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar
|
||||
|
||||
plugins {
|
||||
id("org.openapi.generator") version "7.12.0"
|
||||
id("org.springframework.boot") version "3.4.4"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
java
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
tasks.named("compileJava") {
|
||||
dependsOn("generateJavaApi")
|
||||
dependsOn("generateFrontendApi")
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir("${projectDir}/build/generated-resources/model/src/main/java")
|
||||
exclude("org/openapitools/configuration/SpringDocConfiguration.java")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.springframework.boot:spring-boot-starter-validation")
|
||||
implementation("io.swagger.core.v3:swagger-annotations:2.2.20")
|
||||
implementation("org.openapitools:jackson-databind-nullable:0.2.6")
|
||||
implementation("org.springframework.hateoas:spring-hateoas:2.2.0")
|
||||
}
|
||||
|
||||
tasks.register< GenerateTask>("generateJavaApi") {
|
||||
generatorName.set("spring")
|
||||
library.set("spring-boot")
|
||||
inputSpec.set("${projectDir}/src/main/resources/api.yml")
|
||||
configFile.set("${projectDir}/src/main/resources/config_backend.json")
|
||||
outputDir.set("${projectDir}/build/generated-resources/model")
|
||||
typeMappings.put("OffsetDateTime", "Instant")
|
||||
importMappings.put("java.time.OffsetDateTime", "java.time.Instant")
|
||||
modelNameSuffix.set("Dto")
|
||||
generateModelTests.set(false)
|
||||
generateModelDocumentation.set(false)
|
||||
generateApiTests.set(false)
|
||||
generateApiDocumentation.set(false)
|
||||
generateAliasAsModel.set(true)
|
||||
modelPackage.set("com.alttd.altitudeweb.model")
|
||||
generateApiTests.set(false)
|
||||
}
|
||||
|
||||
tasks.register<GenerateTask>("generateFrontendApi") {
|
||||
generatorName.set("typescript-angular")
|
||||
inputSpec.set("$rootDir/open_api/src/main/resources/api.yml")
|
||||
outputDir.set("${projectDir}/../frontend/src/api")
|
||||
configFile.set("$rootDir/open_api/src/main/resources/config_frontend.json")
|
||||
generateApiTests.set(false)
|
||||
}
|
||||
Reference in New Issue
Block a user