Skip to content

Update OpenAPI version and templates #296

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

dani-garcia
Copy link
Member

@dani-garcia dani-garcia commented May 28, 2025

🎟️ Tracking

📔 Objective

Update the version of openapi generator that we use, and use the latest templates. Because of the autogenerated code, this PR is fairly big so I've split it into easier to parse commits. I recommend reviewing them individually:

  • Update versions: Very straightforward, just bumps all the packages. This doesn't change the generated code in any way

  • Update template files: This updates the template files with the latest in the openAPI repo. Note that this is the templates as they are upstream, without our changes. The next commit will apply only our changes, so it's easy to review and rebase in the future. I basically deleted the contents of the support/openapi-templates and pasted the contents from here: https://github.com/OpenAPITools/openapi-generator/tree/05e672d85672a2f7a97fe0d3601aadc26d43e572/modules/openapi-generator/src/main/resources/rust Best way to validate it's correct would be to do the same thing and check that the files match.

  • Make changes to templates. The changes applied are as follows:

    • Use the uuid crate type instead of strings.
    • Removed the double optional pattern, which was applied when types were nullable & !required. We don't differentiate between nullable and !required, so the double optional only adds complexity.
    • Updated Cargo.toml so it's more in line with ours.
    • Ignored some clippy lints
    • The new templates already contain support for int enums, so that's one less patch we have to do
  • 🤖 Generated code: This is the autogenerated bindings built using ./support/build-api.sh on the same server version as last time bitwarden/server@29dc69a . I haven't used a newer version to reduce the number of changes on this PR. The changes are entirely because of template updates, so rather than review it I'd recommend trying to build the bindings on top and seeing if they match:

    • Models are functionally identical, their Display impl is slightly different but has the same output.
    • API functions are restructured internally, and they now check for a JSON content type before trying to deserialize the response.
    • I've kept the Cargo.toml changes as they were before, because our version is updated with renovate updates.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

This comment was marked as resolved.

@dani-garcia dani-garcia force-pushed the ps/update-open-api branch from 6001b0c to fff9127 Compare May 28, 2025 18:15
Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.28%. Comparing base (307801c) to head (8d3dcd4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #296   +/-   ##
=======================================
  Coverage   70.28%   70.28%           
=======================================
  Files         217      217           
  Lines       16991    16991           
=======================================
  Hits        11942    11942           
  Misses       5049     5049           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dani-garcia dani-garcia requested a review from coroiu May 28, 2025 18:27
@dani-garcia dani-garcia marked this pull request as ready for review May 28, 2025 18:27
@dani-garcia dani-garcia requested a review from a team as a code owner May 28, 2025 18:27
Copy link

sonarqubecloud bot commented Jun 2, 2025

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