Skip to content

Commit 5e341fe

Browse files
committed
GH-237 Cover OpenApiPlugin setup with basic test
1 parent 414aff9 commit 5e341fe

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

examples/javalin-gradle-kotlin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies {
3939

4040
// javalin
4141
implementation("io.javalin:javalin:6.4.0")
42-
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.2")
42+
implementation("com.fasterxml.jackson.core:jackson-databind:2.18.1")
4343

4444
// logging
4545
implementation("ch.qos.logback:logback-classic:1.4.14")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
description = "Javalin OpenAPI Plugin | Serve raw OpenApi documentation under dedicated endpoint"
22

3+
plugins {
4+
kotlin("kapt")
5+
}
6+
37
dependencies {
48
api(project(":openapi-specification"))
9+
10+
kaptTest(project(":openapi-annotation-processor"))
511
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import io.javalin.Javalin
2+
import io.javalin.openapi.OpenApi
3+
import io.javalin.openapi.plugin.OpenApiPlugin
4+
import org.junit.jupiter.api.Test
5+
import org.junit.jupiter.api.assertDoesNotThrow
6+
7+
class OpenApiPluginTest {
8+
9+
@OpenApi(
10+
path = "/test",
11+
)
12+
private object OpenApiTest
13+
14+
@Test
15+
fun `should support schema modifications in definition configuration`() {
16+
assertDoesNotThrow {
17+
Javalin.create { config ->
18+
config.registerPlugin(
19+
OpenApiPlugin { openApiConfig ->
20+
openApiConfig.withDefinitionConfiguration { _, def ->
21+
def.withInfo {
22+
it.title = "My API"
23+
}
24+
}
25+
}
26+
)
27+
}
28+
}
29+
}
30+
31+
@Test
32+
fun `should support empty definition configuration`() {
33+
assertDoesNotThrow {
34+
Javalin.create { config ->
35+
config.registerPlugin(
36+
OpenApiPlugin {
37+
it.withDefinitionConfiguration { _, _ ->
38+
/* do nothing */
39+
}
40+
}
41+
)
42+
}
43+
}
44+
}
45+
46+
}

openapi-specification/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
description = "Javalin OpenAPI Specification | Compile-time OpenAPI integration for Javalin 6.x"
22

33
dependencies {
4-
val jacksonVersion = "2.15.2"
4+
val jacksonVersion = "2.18.1"
55
api("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
66
api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
77
api("com.google.code.gson:gson:2.10.1")

0 commit comments

Comments
 (0)