All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.io.github.smiley4.ktorswaggerui.data.SchemaConfigData.kt Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
package io.github.smiley4.ktorswaggerui.data

import io.github.smiley4.schemakenerator.core.connectSubTypes
import io.github.smiley4.schemakenerator.core.handleNameAnnotation
import io.github.smiley4.schemakenerator.reflection.collectSubTypes
import io.github.smiley4.schemakenerator.reflection.processReflection
import io.github.smiley4.schemakenerator.swagger.compileReferencingRoot
import io.github.smiley4.schemakenerator.swagger.data.CompiledSwaggerSchema
import io.github.smiley4.schemakenerator.swagger.data.TitleType
import io.github.smiley4.schemakenerator.swagger.generateSwaggerSchema
import io.github.smiley4.schemakenerator.swagger.handleCoreAnnotations
import io.github.smiley4.schemakenerator.swagger.withAutoTitle
import kotlin.reflect.KType

/**
 * Common configuration for schemas.
 */
data class SchemaConfigData(
    val schemas: Map,
    val generator: (type: KType) -> CompiledSwaggerSchema,
    val overwrite: Map,
    val securitySchemas: List
) {
    companion object {
        val DEFAULT = SchemaConfigData(
            schemas = emptyMap(),
            generator = { type ->
                type
                    .collectSubTypes()
                    .processReflection()
                    .connectSubTypes()
                    .handleNameAnnotation()
                    .generateSwaggerSchema()
                    .handleCoreAnnotations()
                    .withAutoTitle(TitleType.SIMPLE)
                    .compileReferencingRoot()
            },
            overwrite = emptyMap(),
            securitySchemas = emptyList()
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy