Skip to content

Commit

Permalink
Merge branch 'bugfix/bad-endpoint-names-for-other-tools' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
SMILEY4 committed Dec 21, 2022
2 parents 6299f38 + 005e732 commit 1682cc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ val SwaggerUI = createApplicationPlugin(name = "SwaggerUI", createConfiguration
}

SwaggerRouting(
pluginConfig.getSwaggerUI() ,
pluginConfig.getSwaggerUI(),
application.environment.config,
SWAGGER_UI_WEBJARS_VERSION,
) { apiSpecJson }.setup(application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ import io.ktor.server.routing.RoutingResolveContext
import io.ktor.server.routing.delete
import io.ktor.server.routing.get
import io.ktor.server.routing.head
import io.ktor.server.routing.method
import io.ktor.server.routing.options
import io.ktor.server.routing.patch
import io.ktor.server.routing.post
import io.ktor.server.routing.put
import io.ktor.server.routing.route
import io.ktor.server.routing.method
import io.ktor.util.KtorDsl
import io.ktor.util.pipeline.PipelineContext
import io.ktor.util.pipeline.PipelineInterceptor

class DocumentedRouteSelector(val documentation: OpenApiRoute) : RouteSelector() {

companion object {
private var includeDocumentedRouteInRouteToString = false
fun setIncludeDocumentedRouteInRouteToString(include: Boolean) {
includeDocumentedRouteInRouteToString = include
}
}

override fun evaluate(context: RoutingResolveContext, segmentIndex: Int) = RouteSelectorEvaluation.Transparent

override fun toString() = if (includeDocumentedRouteInRouteToString) super.toString() else ""
}

fun Route.documentation(
Expand Down Expand Up @@ -92,7 +102,6 @@ fun Route.post(
return documentation(builder) { post(path, body) }
}


@JvmName("postTyped")
inline fun <reified R : Any> Route.post(
noinline builder: OpenApiRoute.() -> Unit = { },
Expand All @@ -101,7 +110,6 @@ inline fun <reified R : Any> Route.post(
return documentation(builder) { post(body) }
}


@JvmName("postTypedPath")
inline fun <reified R : Any> Route.post(
path: String,
Expand Down Expand Up @@ -138,7 +146,6 @@ fun Route.put(
return documentation(builder) { put(body) }
}


@JvmName("putTyped")
inline fun <reified R : Any> Route.put(
noinline builder: OpenApiRoute.() -> Unit = { },
Expand All @@ -147,7 +154,6 @@ inline fun <reified R : Any> Route.put(
return documentation(builder) { put(body) }
}


@JvmName("putTypedPath")
inline fun <reified R : Any> Route.put(
path: String,
Expand Down Expand Up @@ -189,7 +195,6 @@ fun Route.patch(
return documentation(builder) { patch(path, body) }
}


@KtorDsl
fun Route.patch(
builder: OpenApiRoute.() -> Unit = { },
Expand All @@ -198,7 +203,6 @@ fun Route.patch(
return documentation(builder) { patch(body) }
}


@JvmName("patchTyped")
inline fun <reified R : Any> Route.patch(
noinline builder: OpenApiRoute.() -> Unit = { },
Expand All @@ -208,7 +212,6 @@ inline fun <reified R : Any> Route.patch(

}


@JvmName("patchTypedPath")
inline fun <reified R : Any> Route.patch(
path: String,
Expand Down
10 changes: 0 additions & 10 deletions src/test/resources/application.conf

This file was deleted.

0 comments on commit 1682cc1

Please sign in to comment.