Skip to content

Commit

Permalink
hide swagger routes
Browse files Browse the repository at this point in the history
  • Loading branch information
SMILEY4 committed Jan 8, 2025
1 parent 9b7bed2 commit 7474d09
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.smiley4.ktoropenapi.builder.route

import io.github.smiley4.ktoropenapi.data.OpenApiPluginData
import io.github.smiley4.ktoropenapi.dsl.routing.DocumentedRouteSelector
import io.github.smiley4.ktoropenapi.dsl.routes.RouteConfig
import io.github.smiley4.ktoropenapi.dsl.routing.DocumentedRouteSelector
import io.ktor.http.HttpMethod
import io.ktor.server.auth.AuthenticationRouteSelector
import io.ktor.server.routing.ConstantParameterRouteSelector
Expand All @@ -22,6 +22,11 @@ internal class RouteCollector {

private val routeDocumentationMerger = RouteDocumentationMerger()

private val hiddenRouteMarkers = setOf(
"io.github.smiley4.ktorswaggerui.SwaggerUIRouteSelector"
)


/**
* Collect all routes from the given application
*/
Expand All @@ -38,6 +43,7 @@ internal class RouteCollector {
)
}
.filter { !it.documentation.hidden }
.filter { path -> hiddenRouteMarkers.none { path.path.contains(it) } }
.filter { path -> config.pathFilter(path.method, path.path.split("/").filter { it.isNotEmpty() }) }
.toList()
}
Expand Down

0 comments on commit 7474d09

Please sign in to comment.