Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
SMILEY4 committed Jun 5, 2023
2 parents 5cd81b9 + cecf09b commit 150b9f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This library provides a Ktor plugin to document routes, generate an OpenApi Spec
- provides swagger-ui with no initial configuration required
- supports most of the [OpenAPI 3.0.3 Specification](https://swagger.io/specification/)
- automatic json-schema generation from arbitrary types/classes for bodies and parameters
- use custom encoder/serializers for examples and json-schemas
- provide custom schemas or a custom schema-builder
- external/custom json-schemas for bodies
- protect Swagger-UI and OpenApi-Spec with custom authentication
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "io.github.smiley4"
version = "2.0.0-rc.3"
version = "2.0.0"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.smiley4.ktorswaggerui

import io.github.smiley4.ktorswaggerui.spec.example.ExampleContext
import io.github.smiley4.ktorswaggerui.spec.example.ExampleContextBuilder
import io.github.smiley4.ktorswaggerui.spec.openapi.ComponentsBuilder
import io.github.smiley4.ktorswaggerui.spec.openapi.ContactBuilder
import io.github.smiley4.ktorswaggerui.spec.openapi.ContentBuilder
Expand All @@ -22,8 +24,6 @@ import io.github.smiley4.ktorswaggerui.spec.openapi.SecurityRequirementsBuilder
import io.github.smiley4.ktorswaggerui.spec.openapi.SecuritySchemesBuilder
import io.github.smiley4.ktorswaggerui.spec.openapi.ServerBuilder
import io.github.smiley4.ktorswaggerui.spec.openapi.TagBuilder
import io.github.smiley4.ktorswaggerui.spec.example.ExampleContext
import io.github.smiley4.ktorswaggerui.spec.example.ExampleContextBuilder
import io.github.smiley4.ktorswaggerui.spec.route.RouteCollector
import io.github.smiley4.ktorswaggerui.spec.route.RouteDocumentationMerger
import io.github.smiley4.ktorswaggerui.spec.route.RouteMeta
Expand All @@ -40,12 +40,15 @@ import io.ktor.server.application.pluginOrNull
import io.ktor.server.routing.Routing
import io.ktor.server.webjars.Webjars
import io.swagger.v3.core.util.Json
import mu.KotlinLogging

/**
* This version must match the version of the gradle dependency
*/
internal const val SWAGGER_UI_WEBJARS_VERSION = "4.15.0"

private val logger = KotlinLogging.logger {}

val SwaggerUI = createApplicationPlugin(name = "SwaggerUI", createConfiguration = ::SwaggerUIPluginConfig) {
var apiSpecJson = "{}"
on(MonitoringEvent(ApplicationStarted)) { application ->
Expand All @@ -58,7 +61,7 @@ val SwaggerUI = createApplicationPlugin(name = "SwaggerUI", createConfiguration
try {
apiSpecJson = Json.pretty(builder(pluginConfig, schemaContext, exampleContext).build(routes))
} catch (e: Exception) {
e.printStackTrace()
logger.error("Error during openapi-generation", e)
}
}
SwaggerRouting(
Expand Down

0 comments on commit 150b9f8

Please sign in to comment.