plugins { java id("io.spring.dependency-management") version "1.1.6" id("org.openapi.generator") version "7.10.0" } group = "org.springframework.samples" val apiArtifact by configurations.creating { isCanBeConsumed = false } java { toolchain { languageVersion = JavaLanguageVersion.of(21) } } dependencyManagement { imports { mavenBom ("org.springframework.boot:spring-boot-dependencies:3.3.6") } } repositories { mavenCentral() } dependencies { apiArtifact(project(":api", "apiArtifact")) implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0") } tasks.withType { dependsOn(tasks.openApiGenerate) } java.sourceSets["main"].java { srcDir(layout.buildDirectory.dir("generated/sources/openapi/src/main/java")) } openApiGenerate { inputSpec.set(apiArtifact.singleFile.absolutePath) outputDir.set(layout.buildDirectory.dir("generated/sources/openapi").map { it.asFile.absolutePath }) generatorName.set("spring") library.set("spring-boot") modelNameSuffix.set("Dto") apiPackage.set("org.springframework.samples.petclinic.rest.api") modelPackage.set("org.springframework.samples.petclinic.rest.dto") supportingFilesConstrainedTo.set(listOf("ApiUtil.java")) globalProperties.set( mapOf( "apis" to "", "models" to "" ) ) configOptions.set( mutableMapOf( "verbose" to "true", "interfaceOnly" to "true", "performBeanValidation" to "true", "dateLibrary" to "java8", "useSpringBoot3" to "true", "openApiNullable" to "false", "serializationLibrary" to "jackson", "documentationProvider" to "springdoc", ) ) }