de.lancom.openapi.jackson.EntityDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
This open-source project provides an OpenAPI 3.0 Parser implemented in Kotlin, utilizing immutable data classes
package de.lancom.openapi.jackson
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
import de.lancom.openapi.entity.Entity
abstract class EntityDeserializer(
clazz: Class,
val parser: Parser,
) : StdDeserializer(clazz) {
override fun deserialize(p: JsonParser?, ctxt: DeserializationContext?): E {
val node: JsonNode = p!!.codec!!.readTree(p)!!
return parser.parseJsonNode(node)
}
}