de.lancom.openapi.refs.Instance.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.refs
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.databind.ser.std.StdSerializer
@JsonSerialize(using = Instance.Companion.Serializer::class)
data class Instance(
val referenced: R,
) : ReferenceOrInstance {
companion object {
class Serializer : StdSerializer>(Instance::class.java) {
override fun serialize(value: Instance<*>?, gen: JsonGenerator?, provider: SerializerProvider?) {
gen!!.writeObject(value!!.referenced)
}
}
}
}