com.ancientlightstudios.quarkus.kotlin.openapi.parser.SchemaPropertyBuilder.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-maven-plugin Show documentation
Show all versions of quarkus-kotlin-openapi-maven-plugin Show documentation
A Maven plugin to use the OpenAPI generator.
package com.ancientlightstudios.quarkus.kotlin.openapi.parser
import com.ancientlightstudios.quarkus.kotlin.openapi.models.hints.OriginPathHint.originPath
import com.ancientlightstudios.quarkus.kotlin.openapi.models.transformable.TransformableSchemaProperty
import com.fasterxml.jackson.databind.node.ObjectNode
class SchemaPropertyBuilder(private val name: String, private val node: ObjectNode) {
fun ParseContext.build(): TransformableSchemaProperty {
return TransformableSchemaProperty(name, parseAsSchema())
.apply {
originPath = contextPath
}
}
}
fun ParseContext.parseAsSchemaProperty(name: String) =
contextNode.asObjectNode { "Json object expected for $contextPath" }
.let {
SchemaPropertyBuilder(name, it).run { [email protected]() }
}