Skip to content

Comments

Generate API models with openapi-generator plugin in new module#992

Merged
bherbst merged 1 commit intothe-blue-alliance:masterfrom
bherbst:swagger_gen
Jan 18, 2025
Merged

Generate API models with openapi-generator plugin in new module#992
bherbst merged 1 commit intothe-blue-alliance:masterfrom
bherbst:swagger_gen

Conversation

@bherbst
Copy link
Contributor

@bherbst bherbst commented Jan 12, 2025

Summary:
Our API models are woefully out of date, and unfortunately I have not had success regenerating our models using the existing infrastructure.

The existing tooling relies on a fork of swagger-codegen that generates interfaces instead of concrete Java classes.

This fork was made when the latest version of swagger specs was 2.0, but TBA's API specs now leverage OpenAPI spec version 3.0.1.

In theory we could bring our swagger-codegen fork up to date with upstream, however there are a few reasons I'm not pursuing that:

  • Leveraging a published tool as-is will allow us to more easily update to new versions in the future
  • I don't personally believe we get much value in generating interfaces over concrete classes. In fact I believe this adds significant additional complexity and we could get a lot more "for free" such as not needing custom deserializers if we lean in to out-of-the-box functionality

This PR only creates a new tba-api module with models and Retrofit interfaces generated by openapi-generator. This PR does not change any existing code to leverage the newly generated modules, and we will need to work our way through the existing codebase to migrate. I plan to do this in small chunks, roughly one at a time as possible.

@bherbst bherbst merged commit 538ce3d into the-blue-alliance:master Jan 18, 2025
4 checks passed
@bherbst bherbst deleted the swagger_gen branch January 18, 2025 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant