From ddbeb889299c4baf42b9de238c4424e3b47d1b88 Mon Sep 17 00:00:00 2001 From: Ryan Brink Date: Thu, 7 Apr 2022 05:02:43 -0700 Subject: [PATCH] fix: put info request body nullable --- CHANGELOG.md | 4 ++++ gradle.properties | 2 +- .../core/metadata/method/PutInfo.kt | 2 +- .../kompendium/playground/BasicPlayground.kt | 20 +++++++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 957aef146..ae5bbdc26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## Released +## [2.3.4] - April 7th, 2022 +### Changed +- Put request body info now nullable + ## [2.3.3] - April 1st, 2022 ### Added - Added tests for Swagger UI module that verify that plugin generates correct responses for Swagger UI WEB resources (tests should detect future incompatible changes in new versions of `org.webjars.swagger-ui`) diff --git a/gradle.properties b/gradle.properties index f446de304..ffb648019 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Kompendium -project.version=2.3.3 +project.version=2.3.4 # Kotlin kotlin.code.style=official # Gradle diff --git a/kompendium-core/src/main/kotlin/io/bkbn/kompendium/core/metadata/method/PutInfo.kt b/kompendium-core/src/main/kotlin/io/bkbn/kompendium/core/metadata/method/PutInfo.kt index 409e56937..cc1c2b2d6 100644 --- a/kompendium-core/src/main/kotlin/io/bkbn/kompendium/core/metadata/method/PutInfo.kt +++ b/kompendium-core/src/main/kotlin/io/bkbn/kompendium/core/metadata/method/PutInfo.kt @@ -6,7 +6,7 @@ import io.bkbn.kompendium.core.metadata.RequestInfo import io.bkbn.kompendium.core.metadata.ResponseInfo data class PutInfo( - val requestInfo: RequestInfo, + val requestInfo: RequestInfo?, override val responseInfo: ResponseInfo, override val summary: String, override val description: String? = null, diff --git a/kompendium-playground/src/main/kotlin/io/bkbn/kompendium/playground/BasicPlayground.kt b/kompendium-playground/src/main/kotlin/io/bkbn/kompendium/playground/BasicPlayground.kt index 12b807409..9adbb2b9f 100644 --- a/kompendium-playground/src/main/kotlin/io/bkbn/kompendium/playground/BasicPlayground.kt +++ b/kompendium-playground/src/main/kotlin/io/bkbn/kompendium/playground/BasicPlayground.kt @@ -9,11 +9,13 @@ import io.bkbn.kompendium.core.Kompendium import io.bkbn.kompendium.core.Notarized.notarizedDelete import io.bkbn.kompendium.core.Notarized.notarizedGet import io.bkbn.kompendium.core.Notarized.notarizedPost +import io.bkbn.kompendium.core.Notarized.notarizedPut import io.bkbn.kompendium.core.metadata.RequestInfo import io.bkbn.kompendium.core.metadata.ResponseInfo import io.bkbn.kompendium.core.metadata.method.DeleteInfo import io.bkbn.kompendium.core.metadata.method.GetInfo import io.bkbn.kompendium.core.metadata.method.PostInfo +import io.bkbn.kompendium.core.metadata.method.PutInfo import io.bkbn.kompendium.core.routes.redoc import io.bkbn.kompendium.core.routes.swagger import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule @@ -24,6 +26,7 @@ import io.bkbn.kompendium.playground.BasicPlaygroundToC.simpleDeleteRequest import io.bkbn.kompendium.playground.BasicPlaygroundToC.simpleGetExample import io.bkbn.kompendium.playground.BasicPlaygroundToC.simpleGetExampleWithParameters import io.bkbn.kompendium.playground.BasicPlaygroundToC.simplePostRequest +import io.bkbn.kompendium.playground.BasicPlaygroundToC.simplePutInfo import io.bkbn.kompendium.playground.util.Util import io.ktor.application.Application import io.ktor.application.call @@ -99,6 +102,11 @@ private fun Application.mainModule() { } } } + route("/update") { + notarizedPut(simplePutInfo) { + call.respond(HttpStatusCode.NoContent) + } + } } } @@ -154,6 +162,18 @@ object BasicPlaygroundToC { tags = setOf("Simple") ) + val simplePutInfo = PutInfo( + summary = "Simple, Documented POST Request", + description = "Showcases how easy it is to document a post request!", + requestInfo = null, + responseInfo = ResponseInfo( + status = HttpStatusCode.OK, + description = "This means everything went as expected!", + examples = mapOf("demo" to BasicResponse(c = "So it is true!", null)) + ), + tags = setOf("Simple") + ) + /** * This showcases a DELETE request */