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 Apr 7, 2023
2 parents acf3a7b + 84126b5 commit 83d5186
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ A wiki with a short documentation is available [here](https://github.com/SMILEY4
1. Add the JitPack repository
```kotlin
repositories {
maven { url "https://jitpack.io" }
maven { url = uri("https://jitpack.io") }
}
```

2. Add the dependency
```kotlin
dependencies {
implementation 'io.github.smiley4:ktor-swagger-ui:<VERSION>'
implementation "io.github.smiley4:ktor-swagger-ui:<VERSION>"
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "io.github.smiley4"
version = "1.4.0"
version = "1.5.0"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class OpenApiRoute {
var deprecated: Boolean = false


/**
* Whether this route is hidden.
*/
var hidden: Boolean = false


/**
* A declaration of which security mechanism can be used for this operation.
* If not specified (and none specified with [securitySchemeNames]), defaultSecuritySchemeName (global plugin config) will be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ class OApiPathsBuilder(private val routeCollector: RouteCollector) {
.filter { removeLeadingSlash(it.path) != removeLeadingSlash("${config.getSwaggerUI().swaggerUrl}/api.json") }
.filter { removeLeadingSlash(it.path) != removeLeadingSlash("${config.getSwaggerUI().swaggerUrl}/{filename}") }
.filter { !config.getSwaggerUI().forwardRoot || it.path != "/" }
.filter { !it.documentation.hidden }
.filter { path ->
config.pathFilter
?.let { it(path.method, path.path.split("/").filter { it.isNotEmpty() }) }
?: true
}
.onEach { logger.debug("Configure path: ${it.method.value} ${it.path}") }
.map {
pathBuilder.build(it, components, config)
}
.map { pathBuilder.build(it, components, config) }
.forEach { addToPaths(this, it.first, it.second) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class RouteCollector {
b.securitySchemeNames?.let { merged.addAll(it) }
}
deprecated = a.deprecated || b.deprecated
hidden = a.hidden || b.hidden
request {
(getParameters() as MutableList).also {
it.addAll(a.getRequest().getParameters())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.server.response.respondText
import io.ktor.server.routing.get
import io.ktor.server.routing.routing
import java.util.Random

Expand Down Expand Up @@ -249,5 +250,12 @@ private fun Application.myModule() {

}

get("hidden", {
hidden = true
description = "This route is hidden and not visible in swagger"
}){
call.respond(HttpStatusCode.NotImplemented, "todo")
}

}
}

0 comments on commit 83d5186

Please sign in to comment.