diff --git a/cinema-api/build.gradle.kts b/cinema-api/build.gradle.kts index 80b9f12..0f1051e 100644 --- a/cinema-api/build.gradle.kts +++ b/cinema-api/build.gradle.kts @@ -2,7 +2,8 @@ description = "Cinema API" plugins { kotlin("jvm") - id("io.github.ermadmi78.kobby") version "4.0.0" + kotlin("plugin.serialization") + id("io.github.ermadmi78.kobby") version "5.3.1" } kotlin { @@ -10,9 +11,9 @@ kotlin { } dependencies { - // Add this dependency to enable Jackson annotation generation in DTO classes - compileOnly("com.fasterxml.jackson.core:jackson-annotations:2.15.4") + // Add this dependency to enable Kotlinx Serialization + compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") // Add this dependency to enable default Ktor adapters generation - compileOnly("io.ktor:ktor-client-cio:2.3.9") + compileOnly("io.ktor:ktor-client-cio:2.3.13") } \ No newline at end of file diff --git a/cinema-client/build.gradle.kts b/cinema-client/build.gradle.kts index c1357bd..4a3843d 100644 --- a/cinema-client/build.gradle.kts +++ b/cinema-client/build.gradle.kts @@ -3,7 +3,7 @@ description = "Cinema Client" plugins { kotlin("jvm") id("org.jetbrains.kotlin.plugin.spring") - id("org.springframework.boot") version "3.2.4" + id("org.springframework.boot") version "3.5.9" } kotlin { @@ -16,13 +16,12 @@ dependencies { implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)) implementation("org.springframework.boot:spring-boot-starter") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.4") - implementation("com.fasterxml.jackson.module:jackson-module-parameter-names:2.15.4") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") - implementation("io.ktor:ktor-client-cio:2.3.9") - implementation("io.ktor:ktor-client-websockets:2.3.9") + implementation("io.ktor:ktor-client-cio:2.3.13") + implementation("io.ktor:ktor-client-websockets:2.3.13") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) diff --git a/cinema-client/src/main/kotlin/io/github/ermadmi78/kobby/cinema/client/application.kt b/cinema-client/src/main/kotlin/io/github/ermadmi78/kobby/cinema/client/application.kt index ffa525b..ce43d75 100644 --- a/cinema-client/src/main/kotlin/io/github/ermadmi78/kobby/cinema/client/application.kt +++ b/cinema-client/src/main/kotlin/io/github/ermadmi78/kobby/cinema/client/application.kt @@ -1,8 +1,5 @@ package io.github.ermadmi78.kobby.cinema.client -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import com.fasterxml.jackson.module.paramnames.ParameterNamesModule import io.github.ermadmi78.kobby.cinema.api.kobby.kotlin.* import io.github.ermadmi78.kobby.cinema.api.kobby.kotlin.adapter.ktor.CinemaCompositeKtorAdapter import io.ktor.client.* @@ -15,7 +12,6 @@ import kotlinx.coroutines.runBlocking import org.springframework.boot.CommandLineRunner import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication -import kotlin.reflect.KClass /** * Created on 16.10.2021 @@ -216,31 +212,19 @@ class Application : CommandLineRunner { private fun createKtorAdapter(): CinemaAdapter { // Create Ktor http client val client = HttpClient(CIO) { + expectSuccess = true install(WebSockets) } - // Create Jackson object mapper - val mapper = jacksonObjectMapper() - .registerModule(ParameterNamesModule(JsonCreator.Mode.PROPERTIES)) - - // Create default implementation of CinemaAdapter - // Note, you can write your own implementation + // Default implementation of CinemaAdapter. + // Note, you can write your own implementation. return CinemaCompositeKtorAdapter( client, "http://localhost:8080/graphql", - "ws://localhost:8080/graphql", - object : CinemaMapper { - override fun serialize(value: Any): String = - mapper.writeValueAsString(value) - - override fun deserialize(content: String, contentType: KClass): T = - mapper.readValue(content, contentType.java) - } + "ws://localhost:8080/graphql" ) { println(">> ${it.query}") - if (!it.variables.isNullOrEmpty()) { - println(">> ${it.variables}") - } + println(">> ${it.variables}") } } } \ No newline at end of file diff --git a/cinema-server/build.gradle.kts b/cinema-server/build.gradle.kts index 21f383e..0ddc35c 100644 --- a/cinema-server/build.gradle.kts +++ b/cinema-server/build.gradle.kts @@ -5,7 +5,7 @@ description = "Cinema Server" plugins { kotlin("jvm") id("org.jetbrains.kotlin.plugin.spring") - id("org.springframework.boot") version "3.2.4" + id("org.springframework.boot") version "3.5.9" } kotlin { @@ -20,11 +20,11 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-webflux") implementation("org.springframework.data:spring-data-commons") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.4") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.8.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.8.1") } \ No newline at end of file diff --git a/cinema-server/src/main/resources/graphiql/index.html b/cinema-server/src/main/resources/graphiql/index.html new file mode 100644 index 0000000..a3a4671 --- /dev/null +++ b/cinema-server/src/main/resources/graphiql/index.html @@ -0,0 +1,79 @@ + + + + + + GraphiQL + + + + + + + +
Loading...
+ + diff --git a/gradle.properties b/gradle.properties index daa9cfe..5b7f049 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # suppress inspection "UnusedProperty" for whole file kotlin.code.style=official -kotlin.version=1.9.23 -kotlinVersion=1.9.23 +kotlin.version=1.9.25 +kotlinVersion=1.9.25 group=io.github.ermadmi78 version=0.0.0-SNAPSHOT diff --git a/settings.gradle.kts b/settings.gradle.kts index f34c7e7..f252c34 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,7 @@ pluginManagement { val kotlinVersion: String by settings plugins { kotlin("jvm") version kotlinVersion + kotlin("plugin.serialization") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion } }