Kotlin / dataframe

Structured data processing in Kotlin
https://kotlin.github.io/dataframe/overview.html
Apache License 2.0
803 stars 55 forks source link

isOpenApiStr logger leaks to Gradle #785

Open koperagen opened 1 month ago

koperagen commented 1 month ago

https://www.kaggle.com/datasets/ruchi798/data-science-job-salaries Try to generate a schema:

schema {
    sourceSet = "test"
    visibility = org.jetbrains.dataframe.gradle.DataSchemaVisibility.IMPLICIT_PUBLIC
    data = file("src/test/resources/ds_salaries.csv")
    name = "org.jetbrains.kotlinx.dataframe.testSets.DsSalaries"
}

image

It appears as an error, while code generation was in fact successful. Looks bad, i'd revisit why this needs logging and remove if possible https://github.com/Kotlin/dataframe/blob/808e3d8c93c80c0cee89dd106bf7911ffd828545/dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/isOpenApi.kt#L15

logger.debug(e) { "Attempt to read input as YAML/JSON OpenAPI specification failed." }
false
Jolanrensen commented 1 month ago

Unfortunately, the logger.debug(e) line you point to is not the actual place the logging occurs. It's in the swagger-parser library, here. I haven't found a way yet to turn off the sl4j warning logs of io.swagger.v3.parser.

Edit: and another one here

Jolanrensen commented 1 month ago

Well... That was a long journey. For some reason, the logger of io.swagger.v3.parser.OpenAPIV3Parser gets the name "i.swagger.v3.parser.OpenAPIV3Parser". So, to disable it, you need that exact name. The logger of io.swagger.v3.parser.util.DeserializationUtils becomes "i.s.v.p.util.DeserializationUtils" for some reason... That explains why I couldn't disable it.

Still, disabling the error is hard. I am able to disable it from normal running code, but it seems like Gradle somewhere is picking it up and piping it to stderr :/

Any ideas?