-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Generate TypeScript code from OpenAPI spec #10181
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
Labels
Comments
Tried to use openAPI generator with next command
But faced next error
More investigation is required. |
Looks like
|
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
We should use the openAPI spec and generate TypeScript typings from them (the same as we do in Java). That way we'll be able to prevent errors from changes in the API affecting the frontend, as well as errors happening from manually typing new endpoints. Also reviewing PRs that will add new APIs will get easier, since currently this involves a lot of time comparing TypeScript types against the OpenAPI specification to make sure they are correct.
We have two options for generations:
Since we currently use react-query, and most common OpenAPI generators are not able to generate query code for that directly, I'd suggest we only generate types for now. Also this will keep us a bit more flexible around our query infrastructure (e.g. around adding Auth to it, etc.), than generating the full query code.
We'll need to figure out which generator to use. The popular OpenAPI generator does unfortunatelly only support generating full query code in TypeScript as far as I can tell. We might need to look for other libraries or check if we can easily just copy types from the query generated code.
The text was updated successfully, but these errors were encountered: