com.ancientlightstudios.quarkus.kotlin.openapi.Config.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-kotlin-openapi-maven-plugin Show documentation
Show all versions of quarkus-kotlin-openapi-maven-plugin Show documentation
A Maven plugin to use the OpenAPI generator.
package com.ancientlightstudios.quarkus.kotlin.openapi
enum class InterfaceType {
SERVER, CLIENT
}
class Config(
/**
* The source files to parse.
*/
val sourceFiles: List,
/**
* The JSON-Patch files to apply to the OpenAPI specification.
*/
val patchFiles: List,
/**
* Path where the debug output should be written.
*/
val debugOutputFile: String? = null,
/**
* The name of the interface to generate.
*/
val interfaceName: String,
/**
* The package name of the generated classes.
*/
val packageName: String,
/**
* Additional package/class imports that should be included. These can contain custom validators or custom type converters.
*/
val additionalImports: List,
/**
* The directory where the generated sources should be put
*/
val outputDirectory: String,
/**
* Path prefix to be prepended to generated endpoints.
*/
val pathPrefix: String = "",
/**
* The endpoints of the API for which the interface should be generated.
* If empty, all endpoints are used.
* Format:
* - /openapi/subscription/{SearchTerm} -> matches exactly this endpoint (all methods)
* - /openapi/subscription/{SearchTerm}:get -> matches only the GET method of this endpoint
* - /openapi/subscription/{SearchTerm}:get,post -> matches only the GET and POST method of this endpoint
*/
val endpoints: List = emptyList(),
/**
* The custom type mappings to use for the generated interface.
* Format:
* - :=
* - string:uuid=java.util.UUID
*/
private val typeMappings: List,
/**
* The type of the interface to generate.
*/
val interfaceType: InterfaceType,
/**
* Whether null values should be omitted in serialization.
*/
val omitNullsInSerialization: Boolean = true,
/**
* A list of additional provider classes which should be added as @RegisterProvider annotations to the generated interface.
*/
val additionalProviders: List = listOf()
) {
fun typeNameFor(type:String, format:String) :String? {
return typeMappings.firstOrNull { it.startsWith("$type:$format=") }?.substringAfter("=")
}
}