com.ancientlightstudios.quarkus.kotlin.openapi.UnsafeJson.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-kotlin-openapi Show documentation
Show all versions of quarkus-kotlin-openapi Show documentation
A support library providing shared classes that the generated code will use.
The newest version!
package com.ancientlightstudios.quarkus.kotlin.openapi
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.ObjectNode
class UnsafeJson(val value: JsonNode) {
@Suppress("unused")
fun modifyObject(block: ObjectNode.() -> ObjectNode) = when (value) {
is ObjectNode -> UnsafeJson(value.run(block))
else -> throw IllegalStateException("object node expected")
}
@Suppress("unused")
fun modifyArray(block: ArrayNode.() -> ArrayNode) = when (value) {
is ArrayNode -> UnsafeJson(value.run(block))
else -> throw IllegalStateException("array node expected")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy