Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☂ Enhance OpenAPI experience #897

Open
Jolanrensen opened this issue Sep 30, 2024 · 0 comments
Open

☂ Enhance OpenAPI experience #897

Jolanrensen opened this issue Sep 30, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed, feel free to help :) OpenAPI Changes related to OpenAPI, JSON (schema), etc. research This requires a deeper dive to gather a better understanding ☂ umbrella issue Label assigned to issues that are collections of smaller issues
Milestone

Comments

@Jolanrensen
Copy link
Collaborator

DataFrame has the ability to import Data Schemas from the type definitions of OpenAPI files: https://kotlin.github.io/dataframe/schemasimportopenapigradle.html, https://kotlin.github.io/dataframe/schemasimportopenapijupyter.html.

This works, but I keep feeling we're missing something:

Just Types?

OpenAPI files contain both the API endpoints (aka urls, parameters etc.) as well as the type schema's of potentially returned types of these endpoints. Currently, DataFrame ignores endpoints and just extracts the types to convert them to DataSchema's. It's up to the user to call the API itself using DataFrame.readJson("url") and convert the result to the generated type (or they call GeneratedType.readJson("url")), however, all of this breaks down when the API has any authentication or requires a PUT instead of a GET request.

At the moment, even with our OpenAPI support, it's not trivial to use DataFrame with a Json API.

Also, OpenAPI with "just types" has a name, it's JSON Schema, but that we don't support right now: #683

Issues with implementation

Our implementation also has a couple issues:

How forward

I have a couple of ideas of how to remedy this situation, but feedback would be welcome.

First of all, we need to take a look at other tools to handle the code generation. An (apparently) industry leading project appears to be OpenAPITools OpenAPI Generator. It can for instance generate a ktor project automatically and with a lot of options. This project can then be used as a dependency in a notebook (even now!) or in another project. I found it works wonders together with our new compiler plugin in this example project. We can use any JSON parser the generator provides, as converting Kotlin objects to DataFrames is easy :) (except perhaps for maps).
However, for this to take off, I'd imagine a situation where a user would just have to import an openAPI file with a single statement and everything would be generated, imported, and ready to go. Especially in notebooks, this would be awesome.

Next, we should probably support "just" Json Schemas to generate DataSchemas. A user could still feed it an openapi file, since they're now a superset of json schema, but it would make it easier to market for sure.

What do you think?

@Jolanrensen Jolanrensen added enhancement New feature or request help wanted Extra attention is needed, feel free to help :) OpenAPI Changes related to OpenAPI, JSON (schema), etc. research This requires a deeper dive to gather a better understanding ☂ umbrella issue Label assigned to issues that are collections of smaller issues labels Sep 30, 2024
@Jolanrensen Jolanrensen added this to the Backlog milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed, feel free to help :) OpenAPI Changes related to OpenAPI, JSON (schema), etc. research This requires a deeper dive to gather a better understanding ☂ umbrella issue Label assigned to issues that are collections of smaller issues
Projects
None yet
Development

No branches or pull requests

1 participant