All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ancientlightstudios.quarkus.kotlin.openapi.parser.ParseContext.kt Maven / Gradle / Ivy

There is a newer version: 0.4.14
Show newest version
package com.ancientlightstudios.quarkus.kotlin.openapi.parser

import com.ancientlightstudios.quarkus.kotlin.openapi.models.openapi.OpenApiVersion
import com.fasterxml.jackson.databind.JsonNode

data class ParseContext(
    val openApiVersion: OpenApiVersion,
    val contextNode: JsonNode,
    val contextPath: String,
    val referenceResolver: ReferenceResolver
) {

    fun contextFor(newContextNode: JsonNode, path: String) =
        ParseContext(openApiVersion, newContextNode, "${this.contextPath}/$path", referenceResolver)

    fun contextFor(path: String): ParseContext {
        val newContextNode = contextNode.resolvePointer(path)
            ?: throw IllegalStateException("Path ${this.contextPath}/$path not resolvable.")
        return contextFor(newContextNode, path)
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy