Skip to content

Commit

Permalink
GH-237 Cover OpenApiPlugin setup with basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Jan 1, 2025
1 parent 414aff9 commit 5e341fe
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/javalin-gradle-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {

// javalin
implementation("io.javalin:javalin:6.4.0")
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.2")
implementation("com.fasterxml.jackson.core:jackson-databind:2.18.1")

// logging
implementation("ch.qos.logback:logback-classic:1.4.14")
Expand Down
6 changes: 6 additions & 0 deletions javalin-plugins/javalin-openapi-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
description = "Javalin OpenAPI Plugin | Serve raw OpenApi documentation under dedicated endpoint"

plugins {
kotlin("kapt")
}

dependencies {
api(project(":openapi-specification"))

kaptTest(project(":openapi-annotation-processor"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import io.javalin.Javalin
import io.javalin.openapi.OpenApi
import io.javalin.openapi.plugin.OpenApiPlugin
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertDoesNotThrow

class OpenApiPluginTest {

@OpenApi(
path = "/test",
)
private object OpenApiTest

@Test
fun `should support schema modifications in definition configuration`() {
assertDoesNotThrow {
Javalin.create { config ->
config.registerPlugin(
OpenApiPlugin { openApiConfig ->
openApiConfig.withDefinitionConfiguration { _, def ->
def.withInfo {
it.title = "My API"
}
}
}
)
}
}
}

@Test
fun `should support empty definition configuration`() {
assertDoesNotThrow {
Javalin.create { config ->
config.registerPlugin(
OpenApiPlugin {
it.withDefinitionConfiguration { _, _ ->
/* do nothing */
}
}
)
}
}
}

}
2 changes: 1 addition & 1 deletion openapi-specification/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
description = "Javalin OpenAPI Specification | Compile-time OpenAPI integration for Javalin 6.x"

dependencies {
val jacksonVersion = "2.15.2"
val jacksonVersion = "2.18.1"
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")
Expand Down

0 comments on commit 5e341fe

Please sign in to comment.