diff --git a/dataframe-openapi/build.gradle.kts b/dataframe-openapi/build.gradle.kts index 85cfb8347..2ac26b705 100644 --- a/dataframe-openapi/build.gradle.kts +++ b/dataframe-openapi/build.gradle.kts @@ -20,6 +20,7 @@ repositories { dependencies { api(project(":core")) + implementation(libs.kotlinLogging) implementation(libs.kotlin.reflect) implementation(libs.kotlinpoet) api(libs.swagger) { diff --git a/dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/isOpenApi.kt b/dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/isOpenApi.kt index a5ae27632..94a3d915a 100644 --- a/dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/isOpenApi.kt +++ b/dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/isOpenApi.kt @@ -1,14 +1,18 @@ package org.jetbrains.kotlinx.dataframe.io +import io.github.oshai.kotlinlogging.KotlinLogging import io.swagger.parser.OpenAPIParser import java.io.File import java.net.URL +private val logger = KotlinLogging.logger {} + /** Needs to have any type schemas to convert. */ public fun isOpenApiStr(text: String): Boolean = try { val parsed = OpenAPIParser().readContents(text, null, null) parsed.openAPI?.components?.schemas != null -} catch (_: Exception) { +} catch (e: Throwable) { + logger.debug(e) { "Attempt to read input as YAML/JSON OpenAPI specification failed." } false }