Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d27d30a31 | |||
8cc229667e | |||
54d12de67a | |||
9b93c887a2 | |||
19d828956b | |||
eabe90acfc | |||
7c2a2a9c9d | |||
15cdfb229d | |||
5a40f37f81 | |||
64f2516f19 | |||
2e5e39d3b2 | |||
5342cf00d1 |
12
CHANGELOG.md
12
CHANGELOG.md
@ -12,6 +12,18 @@
|
|||||||
|
|
||||||
## Released
|
## Released
|
||||||
|
|
||||||
|
## [3.13.0] - March 15th, 2023
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Post, Put, and Patch now support not providing request info
|
||||||
|
|
||||||
|
## [3.12.0] - March 14th, 2023
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add support for swagger documentation
|
||||||
|
|
||||||
## [3.11.0] - January 5th, 2023
|
## [3.11.0] - January 5th, 2023
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.8.0" apply false
|
kotlin("jvm") version "1.8.10" apply false
|
||||||
kotlin("plugin.serialization") version "1.8.0" apply false
|
kotlin("plugin.serialization") version "1.8.10" apply false
|
||||||
id("io.bkbn.sourdough.library.jvm") version "0.12.0" apply false
|
id("io.bkbn.sourdough.library.jvm") version "0.12.0" apply false
|
||||||
id("io.bkbn.sourdough.application.jvm") version "0.12.0" apply false
|
id("io.bkbn.sourdough.application.jvm") version "0.12.0" apply false
|
||||||
id("io.bkbn.sourdough.root") version "0.12.0"
|
id("io.bkbn.sourdough.root") version "0.12.0"
|
||||||
id("com.github.jakemarsden.git-hooks") version "0.0.2"
|
id("com.github.jakemarsden.git-hooks") version "0.0.2"
|
||||||
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
||||||
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
|
id("io.github.gradle-nexus.publish-plugin") version "1.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
gitHooks {
|
gitHooks {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.bkbn.kompendium.core.metadata
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
sealed interface MethodInfoWithRequest : MethodInfo {
|
sealed interface MethodInfoWithRequest : MethodInfo {
|
||||||
val request: RequestInfo
|
val request: RequestInfo?
|
||||||
|
|
||||||
abstract class Builder<T : MethodInfoWithRequest> : MethodInfo.Builder<T>() {
|
abstract class Builder<T : MethodInfoWithRequest> : MethodInfo.Builder<T>() {
|
||||||
internal var request: RequestInfo? = null
|
internal var request: RequestInfo? = null
|
||||||
|
@ -4,7 +4,7 @@ import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
|||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
class PatchInfo private constructor(
|
class PatchInfo private constructor(
|
||||||
override val request: RequestInfo,
|
override val request: RequestInfo?,
|
||||||
override val errors: MutableList<ResponseInfo>,
|
override val errors: MutableList<ResponseInfo>,
|
||||||
override val response: ResponseInfo,
|
override val response: ResponseInfo,
|
||||||
override val tags: Set<String>,
|
override val tags: Set<String>,
|
||||||
@ -26,7 +26,7 @@ class PatchInfo private constructor(
|
|||||||
|
|
||||||
class Builder : MethodInfoWithRequest.Builder<PatchInfo>() {
|
class Builder : MethodInfoWithRequest.Builder<PatchInfo>() {
|
||||||
override fun build() = PatchInfo(
|
override fun build() = PatchInfo(
|
||||||
request = request ?: error("request info must be present"),
|
request = request,
|
||||||
errors = errors,
|
errors = errors,
|
||||||
response = response ?: error("response info must be present"),
|
response = response ?: error("response info must be present"),
|
||||||
tags = tags,
|
tags = tags,
|
||||||
|
@ -4,7 +4,7 @@ import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
|||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
class PostInfo private constructor(
|
class PostInfo private constructor(
|
||||||
override val request: RequestInfo,
|
override val request: RequestInfo?,
|
||||||
override val errors: MutableList<ResponseInfo>,
|
override val errors: MutableList<ResponseInfo>,
|
||||||
override val response: ResponseInfo,
|
override val response: ResponseInfo,
|
||||||
override val tags: Set<String>,
|
override val tags: Set<String>,
|
||||||
@ -26,7 +26,7 @@ class PostInfo private constructor(
|
|||||||
|
|
||||||
class Builder : MethodInfoWithRequest.Builder<PostInfo>() {
|
class Builder : MethodInfoWithRequest.Builder<PostInfo>() {
|
||||||
override fun build() = PostInfo(
|
override fun build() = PostInfo(
|
||||||
request = request ?: error("request info must be present"),
|
request = request,
|
||||||
errors = errors,
|
errors = errors,
|
||||||
response = response ?: error("response info must be present"),
|
response = response ?: error("response info must be present"),
|
||||||
tags = tags,
|
tags = tags,
|
||||||
|
@ -4,7 +4,7 @@ import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
|||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
class PutInfo private constructor(
|
class PutInfo private constructor(
|
||||||
override val request: RequestInfo,
|
override val request: RequestInfo?,
|
||||||
override val errors: MutableList<ResponseInfo>,
|
override val errors: MutableList<ResponseInfo>,
|
||||||
override val response: ResponseInfo,
|
override val response: ResponseInfo,
|
||||||
override val tags: Set<String>,
|
override val tags: Set<String>,
|
||||||
@ -26,7 +26,7 @@ class PutInfo private constructor(
|
|||||||
|
|
||||||
class Builder : MethodInfoWithRequest.Builder<PutInfo>() {
|
class Builder : MethodInfoWithRequest.Builder<PutInfo>() {
|
||||||
override fun build() = PutInfo(
|
override fun build() = PutInfo(
|
||||||
request = request ?: error("request info must be present"),
|
request = request,
|
||||||
errors = errors,
|
errors = errors,
|
||||||
response = response ?: error("response info must be present"),
|
response = response ?: error("response info must be present"),
|
||||||
tags = tags,
|
tags = tags,
|
||||||
|
@ -18,7 +18,7 @@ import kotlinx.html.unsafe
|
|||||||
/**
|
/**
|
||||||
* Provides an out-of-the-box route to view docs using ReDoc on the specified [path].
|
* Provides an out-of-the-box route to view docs using ReDoc on the specified [path].
|
||||||
* @param pageTitle Webpage title you wish to be displayed on your docs
|
* @param pageTitle Webpage title you wish to be displayed on your docs
|
||||||
* @param route path to docs resource
|
* @param path path to docs resource
|
||||||
* @param specUrl url to point ReDoc to the OpenAPI json document
|
* @param specUrl url to point ReDoc to the OpenAPI json document
|
||||||
*/
|
*/
|
||||||
fun Route.redoc(pageTitle: String = "Docs", path: String = "/docs", specUrl: String = "/openapi.json") {
|
fun Route.redoc(pageTitle: String = "Docs", path: String = "/docs", specUrl: String = "/openapi.json") {
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
package io.bkbn.kompendium.core.routes
|
||||||
|
|
||||||
|
import io.ktor.server.application.call
|
||||||
|
import io.ktor.server.html.respondHtml
|
||||||
|
import io.ktor.server.routing.Route
|
||||||
|
import io.ktor.server.routing.get
|
||||||
|
import io.ktor.server.routing.route
|
||||||
|
import kotlinx.html.body
|
||||||
|
import kotlinx.html.div
|
||||||
|
import kotlinx.html.head
|
||||||
|
import kotlinx.html.id
|
||||||
|
import kotlinx.html.link
|
||||||
|
import kotlinx.html.meta
|
||||||
|
import kotlinx.html.script
|
||||||
|
import kotlinx.html.title
|
||||||
|
import kotlinx.html.unsafe
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an out-of-the-box route to view docs using Swagger
|
||||||
|
* @see <a href="https://swagger.io/specification/">Swagger OpenApi Specification</a>
|
||||||
|
* for the latest supported open api version.
|
||||||
|
* @param pageTitle Webpage title you wish to be displayed on your docs
|
||||||
|
* @param path path to docs resource
|
||||||
|
* @param specUrl url to point Swagger to the OpenAPI json document
|
||||||
|
* @param swaggerVersion version of swagger-ui distribution
|
||||||
|
*/
|
||||||
|
fun Route.swagger(
|
||||||
|
pageTitle: String = "Docs",
|
||||||
|
path: String = "/swagger-ui",
|
||||||
|
specUrl: String = "/openapi.json",
|
||||||
|
swaggerVersion: String? = null
|
||||||
|
) {
|
||||||
|
val swaggerVersionSuffix = if (swaggerVersion == null) "" else "@$swaggerVersion"
|
||||||
|
|
||||||
|
route(path) {
|
||||||
|
get {
|
||||||
|
call.respondHtml {
|
||||||
|
head {
|
||||||
|
title {
|
||||||
|
+pageTitle
|
||||||
|
}
|
||||||
|
meta {
|
||||||
|
charset = "utf-8"
|
||||||
|
}
|
||||||
|
meta {
|
||||||
|
name = "viewport"
|
||||||
|
content = "width=device-width, initial-scale=1"
|
||||||
|
}
|
||||||
|
link {
|
||||||
|
href = "https://unpkg.com/swagger-ui-dist$swaggerVersionSuffix/swagger-ui.css"
|
||||||
|
rel = "stylesheet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
div {
|
||||||
|
id = "swagger-ui"
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
src = "https://unpkg.com/swagger-ui-dist$swaggerVersionSuffix/swagger-ui-standalone-preset.js"
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
src = "https://unpkg.com/swagger-ui-dist$swaggerVersionSuffix/swagger-ui-bundle.js"
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
+"""
|
||||||
|
<script>
|
||||||
|
window.onload = function () {
|
||||||
|
// Build a system
|
||||||
|
const ui = SwaggerUIBundle({
|
||||||
|
url: "$specUrl",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout",
|
||||||
|
})
|
||||||
|
window.ui = ui
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -72,13 +72,15 @@ object Helpers {
|
|||||||
|
|
||||||
when (this) {
|
when (this) {
|
||||||
is MethodInfoWithRequest -> {
|
is MethodInfoWithRequest -> {
|
||||||
|
this.request?.let { reqInfo ->
|
||||||
SchemaGenerator.fromTypeOrUnit(
|
SchemaGenerator.fromTypeOrUnit(
|
||||||
type = this.request.requestType,
|
type = reqInfo.requestType,
|
||||||
cache = spec.components.schemas,
|
cache = spec.components.schemas,
|
||||||
schemaConfigurator = schemaConfigurator,
|
schemaConfigurator = schemaConfigurator,
|
||||||
enrichment = this.request.typeEnrichment,
|
enrichment = reqInfo.typeEnrichment,
|
||||||
)?.let { schema ->
|
)?.let { schema ->
|
||||||
spec.components.schemas[this.request.requestType.getSlug(this.request.typeEnrichment)] = schema
|
spec.components.schemas[reqInfo.requestType.getSlug(reqInfo.typeEnrichment)] = schema
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,15 +123,17 @@ object Helpers {
|
|||||||
?.map { listOf(it).toMap() }
|
?.map { listOf(it).toMap() }
|
||||||
?.toMutableList(),
|
?.toMutableList(),
|
||||||
requestBody = when (this) {
|
requestBody = when (this) {
|
||||||
is MethodInfoWithRequest -> Request(
|
is MethodInfoWithRequest -> this.request?.let { reqInfo ->
|
||||||
description = this.request.description,
|
Request(
|
||||||
content = this.request.requestType.toReferenceContent(
|
description = reqInfo.description,
|
||||||
examples = this.request.examples,
|
content = reqInfo.requestType.toReferenceContent(
|
||||||
mediaTypes = this.request.mediaTypes,
|
examples = reqInfo.examples,
|
||||||
enrichment = this.request.typeEnrichment
|
mediaTypes = reqInfo.mediaTypes,
|
||||||
|
enrichment = reqInfo.typeEnrichment
|
||||||
),
|
),
|
||||||
required = true
|
required = true
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
else -> null
|
else -> null
|
||||||
},
|
},
|
||||||
|
@ -48,6 +48,7 @@ import io.bkbn.kompendium.core.util.polymorphicCollectionResponse
|
|||||||
import io.bkbn.kompendium.core.util.polymorphicException
|
import io.bkbn.kompendium.core.util.polymorphicException
|
||||||
import io.bkbn.kompendium.core.util.polymorphicMapResponse
|
import io.bkbn.kompendium.core.util.polymorphicMapResponse
|
||||||
import io.bkbn.kompendium.core.util.polymorphicResponse
|
import io.bkbn.kompendium.core.util.polymorphicResponse
|
||||||
|
import io.bkbn.kompendium.core.util.postNoReqBody
|
||||||
import io.bkbn.kompendium.core.util.primitives
|
import io.bkbn.kompendium.core.util.primitives
|
||||||
import io.bkbn.kompendium.core.util.reqRespExamples
|
import io.bkbn.kompendium.core.util.reqRespExamples
|
||||||
import io.bkbn.kompendium.core.util.requiredParams
|
import io.bkbn.kompendium.core.util.requiredParams
|
||||||
@ -129,6 +130,9 @@ class KompendiumTest : DescribeSpec({
|
|||||||
it("Can override media types") {
|
it("Can override media types") {
|
||||||
openApiTestAllSerializers("T0052__override_media_types.json") { overrideMediaTypes() }
|
openApiTestAllSerializers("T0052__override_media_types.json") { overrideMediaTypes() }
|
||||||
}
|
}
|
||||||
|
it("Can support a post request with no request body") {
|
||||||
|
openApiTestAllSerializers("T0065__post_no_req_body.json") { postNoReqBody() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
describe("Route Parsing") {
|
describe("Route Parsing") {
|
||||||
it("Can parse a simple path and store it under the expected route") {
|
it("Can parse a simple path and store it under the expected route") {
|
||||||
|
@ -299,3 +299,19 @@ fun Routing.overrideMediaTypes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Routing.postNoReqBody() {
|
||||||
|
route("/no_req_body") {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
post = PostInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
responseType<TestResponse>()
|
||||||
|
description("Cool response")
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
72
core/src/test/resources/T0065__post_no_req_body.json
Normal file
72
core/src/test/resources/T0065__post_no_req_body.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/no_req_body": {
|
||||||
|
"post": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Cool response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.SerializationFeature
|
|||||||
import io.bkbn.kompendium.core.fixtures.TestSpecs.defaultSpec
|
import io.bkbn.kompendium.core.fixtures.TestSpecs.defaultSpec
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
||||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||||
import io.bkbn.kompendium.oas.OpenApiSpec
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
@ -130,6 +131,7 @@ object TestHelpers {
|
|||||||
}
|
}
|
||||||
application(applicationSetup)
|
application(applicationSetup)
|
||||||
routing {
|
routing {
|
||||||
|
swagger()
|
||||||
redoc()
|
redoc()
|
||||||
routeUnderTest()
|
routeUnderTest()
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Kompendium
|
# Kompendium
|
||||||
project.version=3.11.1
|
project.version=3.13.0
|
||||||
# Kotlin
|
# Kotlin
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
# Gradle
|
# Gradle
|
||||||
@ -9,6 +9,6 @@ org.gradle.jvmargs=-Xmx2000m
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
ktorVersion=2.2.2
|
ktorVersion=2.2.3
|
||||||
kotestVersion=5.5.4
|
kotestVersion=5.5.5
|
||||||
detektVersion=1.21.0
|
detektVersion=1.21.0
|
||||||
|
@ -23,7 +23,7 @@ dependencies {
|
|||||||
// Kompendium
|
// Kompendium
|
||||||
api(projects.kompendiumEnrichment)
|
api(projects.kompendiumEnrichment)
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.0")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.10")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
|
||||||
|
|
||||||
// Formatting
|
// Formatting
|
||||||
|
@ -22,8 +22,8 @@ dependencies {
|
|||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
|
|
||||||
implementation(projects.kompendiumCore)
|
implementation(projects.kompendiumCore)
|
||||||
implementation("io.ktor:ktor-server-core:2.2.2")
|
implementation("io.ktor:ktor-server-core:2.2.3")
|
||||||
implementation("io.ktor:ktor-server-locations:2.2.2")
|
implementation("io.ktor:ktor-server-locations:2.2.3")
|
||||||
|
|
||||||
// TESTING
|
// TESTING
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ dependencies {
|
|||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
implementation("org.apache.logging.log4j:log4j-api-kotlin:1.2.0")
|
implementation("org.apache.logging.log4j:log4j-api-kotlin:1.2.0")
|
||||||
implementation("org.apache.logging.log4j:log4j-api:2.19.0")
|
implementation("org.apache.logging.log4j:log4j-api:2.20.0")
|
||||||
implementation("org.apache.logging.log4j:log4j-core:2.19.0")
|
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
|
||||||
implementation("org.slf4j:slf4j-api:2.0.6")
|
implementation("org.slf4j:slf4j-api:2.0.6")
|
||||||
implementation("org.slf4j:slf4j-simple:2.0.6")
|
implementation("org.slf4j:slf4j-simple:2.0.6")
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.component.Components
|
import io.bkbn.kompendium.oas.component.Components
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
@ -68,6 +69,7 @@ private fun Application.mainModule() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
authenticate("basic") {
|
authenticate("basic") {
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
|
@ -4,6 +4,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
@ -49,6 +50,7 @@ private fun Application.mainModule() {
|
|||||||
schemaConfigurator = KotlinXSchemaConfigurator()
|
schemaConfigurator = KotlinXSchemaConfigurator()
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
idDocumentation()
|
idDocumentation()
|
||||||
|
@ -4,6 +4,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
||||||
@ -51,6 +52,7 @@ private fun Application.mainModule() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
|
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
|
@ -5,6 +5,7 @@ import io.bkbn.kompendium.core.metadata.PostInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.enrichment.TypeEnrichment
|
import io.bkbn.kompendium.enrichment.TypeEnrichment
|
||||||
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
@ -50,6 +51,7 @@ private fun Application.mainModule() {
|
|||||||
schemaConfigurator = KotlinXSchemaConfigurator()
|
schemaConfigurator = KotlinXSchemaConfigurator()
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
enrichedDocumentation()
|
enrichedDocumentation()
|
||||||
post {
|
post {
|
||||||
|
@ -4,6 +4,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
||||||
@ -50,6 +51,7 @@ private fun Application.mainModule() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
|
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
|
@ -6,6 +6,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
@ -48,6 +49,7 @@ private fun Application.mainModule() {
|
|||||||
schemaConfigurator = GsonSchemaConfigurator()
|
schemaConfigurator = GsonSchemaConfigurator()
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
|
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
|
@ -5,6 +5,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.component.Components
|
import io.bkbn.kompendium.oas.component.Components
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
@ -80,6 +81,7 @@ private fun Application.mainModule() {
|
|||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
authenticate("basic") {
|
authenticate("basic") {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
locationDocumentation()
|
locationDocumentation()
|
||||||
|
@ -8,6 +8,7 @@ import io.bkbn.kompendium.core.metadata.GetInfo
|
|||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
@ -51,6 +52,7 @@ private fun Application.mainModule() {
|
|||||||
schemaConfigurator = JacksonSchemaConfigurator()
|
schemaConfigurator = JacksonSchemaConfigurator()
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
|
|
||||||
route("/{id}") {
|
route("/{id}") {
|
||||||
|
@ -3,6 +3,7 @@ package io.bkbn.kompendium.playground
|
|||||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.locations.NotarizedLocations
|
import io.bkbn.kompendium.locations.NotarizedLocations
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
@ -72,6 +73,7 @@ private fun Application.mainModule() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
get<Listing> { listing ->
|
get<Listing> { listing ->
|
||||||
call.respondText("Listing ${listing.name}, page ${listing.page}")
|
call.respondText("Listing ${listing.name}, page ${listing.page}")
|
||||||
|
@ -3,6 +3,7 @@ package io.bkbn.kompendium.playground
|
|||||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
import io.bkbn.kompendium.oas.payload.Parameter
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
||||||
@ -73,6 +74,7 @@ private fun Application.mainModule() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
swagger(pageTitle = "Simple API Docs")
|
||||||
redoc(pageTitle = "Simple API Docs")
|
redoc(pageTitle = "Simple API Docs")
|
||||||
get<ListingResource> { listing ->
|
get<ListingResource> { listing ->
|
||||||
call.respondText("Listing ${listing.name}, page ${listing.page}")
|
call.respondText("Listing ${listing.name}, page ${listing.page}")
|
||||||
|
@ -22,8 +22,8 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
implementation(projects.kompendiumJsonSchema)
|
implementation(projects.kompendiumJsonSchema)
|
||||||
implementation("com.google.protobuf:protobuf-java:3.21.12")
|
implementation("com.google.protobuf:protobuf-java:3.22.0")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.0")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.10")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
|
||||||
|
|
||||||
// Formatting
|
// Formatting
|
||||||
|
@ -22,8 +22,8 @@ dependencies {
|
|||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
|
|
||||||
implementation(projects.kompendiumCore)
|
implementation(projects.kompendiumCore)
|
||||||
implementation("io.ktor:ktor-server-core:2.2.2")
|
implementation("io.ktor:ktor-server-core:2.2.3")
|
||||||
implementation("io.ktor:ktor-server-resources:2.2.2")
|
implementation("io.ktor:ktor-server-resources:2.2.3")
|
||||||
|
|
||||||
// TESTING
|
// TESTING
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user