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

main.io.github.smiley4.ktorswaggerui.routing.ApiSpec.kt Maven / Gradle / Ivy

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

import io.github.smiley4.ktorswaggerui.data.SwaggerUIData

object ApiSpec {

    var swaggerUiConfig: SwaggerUIData = SwaggerUIData.DEFAULT

    private val apiSpecs = mutableMapOf()

    fun setAll(specs: Map) {
        apiSpecs.clear()
        apiSpecs.putAll(specs)
    }

    fun set(name: String, spec: String) {
        apiSpecs[name] = spec
    }

    fun get(name: String): String {
        return apiSpecs[name] ?: throw NoSuchElementException("No api-spec with name '$name' registered.")
    }

    fun getAll(): Map {
        return apiSpecs
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy