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

Update OpenAPI templates and generator #796

Merged
merged 2 commits into from
May 23, 2024
Merged

Update OpenAPI templates and generator #796

merged 2 commits into from
May 23, 2024

Conversation

dani-garcia
Copy link
Member

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Update OpenAPI templates and generator to the latest version available:

The first commit (5564407) contains the changes from upstream as-is, the second commit (1249b12) contains all the changes we need to make. This way it should be easier to apply the changes in the future.

The diff with upstream is a bit smaller now and also does less unnecessary allocations. Also I've updated the Cargo.toml template to more closely match ours. Once this is approved I'll make a separate PR to regenerate the bindings.

The changes to the generated bindings are fairly minor:

  • The bindings are now capable of base64 decoding values that are marked as [JsonConverter(typeof(Base64UrlConverter))] on the server. We have some API endpoints that make use of it on the server but at the moment we're not using them.
  • The model structs now implement Default
  • The resulting code generates less warnings now, so we can be more selective with what warnings we disable.

Reference OpenAPI commit: 638af0fe37e2786ca3d6f5a8d764b346b2cc74a6
- Cargo.toml: better match what we use
- model.mustache: int enum support and removed double optional
- lib.mustache: disable some extra warnings
- api.mustache: uuid support
@dani-garcia dani-garcia marked this pull request as ready for review May 22, 2024 15:33
Copy link
Contributor

github-actions bot commented May 22, 2024

Logo
Checkmarx One – Scan Summary & Detailsa6d9e44b-84df-4537-bce4-4266faf2f0aa

No New Or Fixed Issues Found

Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.55%. Comparing base (656cf5d) to head (98ad6d1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #796   +/-   ##
=======================================
  Coverage   58.55%   58.55%           
=======================================
  Files         178      178           
  Lines       11544    11544           
=======================================
  Hits         6760     6760           
  Misses       4784     4784           

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

@dani-garcia dani-garcia requested a review from Hinton May 22, 2024 15:38
Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we open a PR with the changes for the bindings? I think the templates looks good but would be nice to look at the bindings before merging this.

@dani-garcia
Copy link
Member Author

@Hinton Sounds good, here are the bindings #797

@dani-garcia dani-garcia merged commit 5d8536b into main May 23, 2024
104 of 105 checks passed
@dani-garcia dani-garcia deleted the ps/update-openapi branch May 23, 2024 15:58
dani-garcia added a commit that referenced this pull request May 24, 2024
## Type of change
```
- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
```

## Objective
Regenerate bindings based on the changes in #796 

Based on server at commit
bitwarden/server@a9ab894
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.

None yet

2 participants