Is anyone using dataframe-openapi ? I have an erro...
# datascience
d
Is anyone using dataframe-openapi ? I have an error with this API
Copy code
%use dataframe
Copy code
val telecomsxchange = importDataSchema(
    "<https://destinations-api.telecomsxchange.com/openapi.json>"
)
/* gives:
Failed to read data schema from <https://destinations-api.telecomsxchange.com/openapi.json>: kotlin.NotImplementedError: An operation is not implemented: Not yet implemented
πŸ‘€ 1
Something is funny and wrong, it prints this error message:
Failed to read data schema from <https://destinations-api.telecomsxchange.com/openapi.json>: kotlin.NotImplementedError: An operation is not implemented: Not yet implemented
When I go to impl. I see this code:
Copy code
is org.jetbrains.kotlinx.dataframe.impl.codeGen.CodeGenerationReadResult.Error -> {
     DISPLAY("Failed to read data schema from ${'$'}url: ${'$'}{codeGenResult.reason}")
 }
Why the string interpolation works if ${'$'} is used instead of just $ ?
j
OpenAPI support is considered experimental, so you'll need to enable it explicitly: https://kotlin.github.io/dataframe/schemasimportopenapijupyter.html
d
Crazy, thanks, it worked: Data schema successfully imported as telecomsxchange: telecomsxchangeDataSchema
j
Actually, the
importDataSchema()
shouldn't even be available when this argument is not supplied πŸ˜… I'll make an issue to hide it when
%use dataframe(enableExperimentalOpenApi=true)
is not supplied. Or provide a useful exception
actually, it should have displayed
"importDataSchema() did not find any supported type-only data schema generation providers (SupportedCodeGenerationFormat
). If you were looking for OpenAPI 3.0.0 types, set
%use dataframe(..., enableExperimentalOpenApi=true)
."` ... that's weird
d
Also I feel the development is a bit slow, openapi support was announced in 2023 (found in a slack message) ? still experimental
j
ouch, man 😜
Actually, it was considered "stable", but OpenAPI has moved to 3.1.0 and merged with JSONSchema
d
actually, it should have displayed
"importDataSchema() did not find any supported type-only data schema generation providers (SupportedCodeGenerationFormat
). If you were looking for OpenAPI 3.0.0 types, set
%use dataframe(..., enableExperimentalOpenApi=true)
."` ... that's weird
No it prints:
Copy code
Failed to read data schema from <https://destinations-api.telecomsxchange.com/openapi.json>: kotlin.NotImplementedError: An operation is not implemented: Not yet implemented
Actually, it was considered "stable", but OpenAPI has moved to 3.1.0 and merged with JSONSchema
Oh ok
j
With the limited number of users we have for that module, we decided to "downgrade" it to experimental until we have the time to find a better solution. Perhaps adding JsonSchema support directly. That would make more sense, as OpenAPI provides things like API endpoints which DataFrame cannot do anything useful with
But this will be after the 1.0 release of DataFrame πŸ™‚ It needs a lot of investigating, maybe collaboration with ktor, who knows
d
Well right now I had some API data fetching and analysis tasks, so it would be handy
j
d
Why not write there this exact message "Actually, it was considered "stable", but OpenAPI has moved to 3.1.0 and merged with JSONSchema" - developers like to know why πŸ™‚, it gives more context PS, it's about: > This is very unhelpful, as it does not provide any information about what to do.
j
Why the string interpolation works if ${'$'} is used instead of just $ ?
Because the whole thing is in a String, which is passed to the Kotlin Jupyter kernel to be run on the client side πŸ™‚ The
$
only needs to be evaluated at the user-side inside the notebook, not in the code here. We could use multi-dollar string interpolation now
I guess yes, we could provide more context
then again, users may find https://github.com/Kotlin/dataframe/issues/897 with all collected information about the current state of openapi
d
val telecomsxchange = importDataSchema( "https://destinations-api.telecomsxchange.com/openapi.json" ) I don't see any useful methods for telecomsxchange
Well I will use the old method: DataFrame.readJson("https://destinations-api.telecomsxchange.com/search/?limit=50&amp;page=1") it works
j
Actually, I see https://destinations-api.telecomsxchange.com/openapi.json uses openapi 3.1.0, which may cause issues, so I'd probably avoid using it in DataFrame
d
okay
Well, thanks for info and more context about openapi support πŸ™‚
j
np πŸ™‚ feel free to try it again if you find a 3.0 openAPI spec. It's supposed to generate something like this, where you can call
MetricsKeyValue.readJson()
and have it be typed as expected.
πŸ‘πŸ» 1
however, this is what it generates for your 3.1 spec, haha, not very helpful, just some enums
but it doesn't understand the types whatsoever