diff --git a/build.gradle.kts b/build.gradle.kts index 0336f47..37f3e3a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -121,9 +121,9 @@ subprojects { testImplementation("org.assertj:assertj-core:3.24.2") testImplementation("net.javacrumbs.json-unit:json-unit-assertj:2.36.1") - testImplementation("com.konghq:unirest-java:3.14.1") + testImplementation("com.konghq:unirest-java:3.14.2") - testImplementation("ch.qos.logback:logback-classic:1.4.5") + testImplementation("ch.qos.logback:logback-classic:1.4.6") } tasks.withType { diff --git a/examples/javalin-gradle-kotlin/src/main/java/io/javalin/openapi/plugin/test/JavalinTest.java b/examples/javalin-gradle-kotlin/src/main/java/io/javalin/openapi/plugin/test/JavalinTest.java index 0a96913..5a40287 100644 --- a/examples/javalin-gradle-kotlin/src/main/java/io/javalin/openapi/plugin/test/JavalinTest.java +++ b/examples/javalin-gradle-kotlin/src/main/java/io/javalin/openapi/plugin/test/JavalinTest.java @@ -91,7 +91,6 @@ public static void main(String[] args) { openApiLicense.setIdentifier("Apache-2.0"); openApiInfo.setTitle("Awesome App"); - openApiInfo.setSummary("App summary"); openApiInfo.setDescription("App description goes right here"); openApiInfo.setTermsOfService("https://example.com/tos"); openApiInfo.setContact(openApiContact); diff --git a/javalin-plugins/javalin-openapi-plugin/src/main/kotlin/io/javalin/openapi/plugin/OpenApiPlugin.kt b/javalin-plugins/javalin-openapi-plugin/src/main/kotlin/io/javalin/openapi/plugin/OpenApiPlugin.kt index d916a28..42d5776 100644 --- a/javalin-plugins/javalin-openapi-plugin/src/main/kotlin/io/javalin/openapi/plugin/OpenApiPlugin.kt +++ b/javalin-plugins/javalin-openapi-plugin/src/main/kotlin/io/javalin/openapi/plugin/OpenApiPlugin.kt @@ -1,11 +1,10 @@ package io.javalin.openapi.plugin +import com.fasterxml.jackson.annotation.JsonInclude.Include import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.ObjectNode import io.javalin.Javalin -import io.javalin.json.JavalinJackson -import io.javalin.json.jsonMapper import io.javalin.openapi.OpenApiLoader import io.javalin.plugin.Plugin import kotlin.DeprecationLevel.WARNING @@ -28,9 +27,9 @@ open class OpenApiPlugin @JvmOverloads constructor(private val configuration: Op private fun createDocumentation(app: Javalin): Lazy> = lazy { - val jsonMapper = when (val jsonMapper = app.jsonMapper()) { - is JavalinJackson -> jsonMapper.mapper - else -> JavalinJackson.defaultMapper() + // skip nulls from cfg + val jsonMapper = lazy { + ObjectMapper().setSerializationInclusion(Include.NON_NULL) } OpenApiLoader() @@ -38,7 +37,7 @@ open class OpenApiPlugin @JvmOverloads constructor(private val configuration: Op .mapValues { (version, rawDocs) -> configuration.definitionConfiguration ?.let { DefinitionConfiguration().also { definition -> it.accept(version, definition) } } - ?.applyConfigurationTo(jsonMapper, version, rawDocs) + ?.applyConfigurationTo(jsonMapper.value, version, rawDocs) ?: rawDocs } } diff --git a/openapi-annotation-processor/src/main/kotlin/io/javalin/openapi/processor/generators/OpenApiGenerator.kt b/openapi-annotation-processor/src/main/kotlin/io/javalin/openapi/processor/generators/OpenApiGenerator.kt index 2d1f6f7..4e022bb 100644 --- a/openapi-annotation-processor/src/main/kotlin/io/javalin/openapi/processor/generators/OpenApiGenerator.kt +++ b/openapi-annotation-processor/src/main/kotlin/io/javalin/openapi/processor/generators/OpenApiGenerator.kt @@ -98,7 +98,7 @@ internal class OpenApiGenerator { */ private fun generateSchema(openApiAnnotations: Collection>): String { val openApi = JsonObject() - openApi.addProperty("openapi", "3.0.3") + openApi.addProperty("openapi", "3.1.0") // fill info val info = JsonObject() diff --git a/openapi-annotation-processor/src/test/kotlin/io/javalin/openapi/processor/OpenApiAnnotationTest.kt b/openapi-annotation-processor/src/test/kotlin/io/javalin/openapi/processor/OpenApiAnnotationTest.kt index 6d387fc..6c55b49 100644 --- a/openapi-annotation-processor/src/test/kotlin/io/javalin/openapi/processor/OpenApiAnnotationTest.kt +++ b/openapi-annotation-processor/src/test/kotlin/io/javalin/openapi/processor/OpenApiAnnotationTest.kt @@ -23,7 +23,7 @@ internal class OpenApiAnnotationTest : OpenApiAnnotationProcessorSpecification() fun should_generate_info() = withOpenApi("should_generate_info") { assertThatJson(it) .isObject - .containsEntry("openapi", "3.0.3") + .containsEntry("openapi", "3.1.0") .containsEntry("info", json("""{ "title":"", "version": "" }""")) } diff --git a/openapi-specification/build.gradle.kts b/openapi-specification/build.gradle.kts index c348744..a00a940 100644 --- a/openapi-specification/build.gradle.kts +++ b/openapi-specification/build.gradle.kts @@ -1,6 +1,8 @@ description = "Javalin OpenAPI Specification | Compile-time OpenAPI integration for Javalin 5.x" dependencies { - api("com.fasterxml.jackson.core:jackson-databind:2.14.2") + val jacksonVersion = "2.14.2" + api("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") api("com.google.code.gson:gson:2.10.1") } \ No newline at end of file