[PR #4386] [MERGED] Change API and structs to camelCase #3425

Closed
opened 2026-03-03 09:58:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/4386
Author: @dani-garcia
Created: 2/28/2024
Status: Merged
Merged: 6/23/2024
Merged by: @dani-garcia

Base: mainHead: remove_upcase


📝 Commits (9)

  • ccdcbc8 Change API inputs/outputs and structs to camelCase
  • 8daa359 Fix fields and password history
  • 716c9ad Use convert_json_key_lcase_first
  • 813994e Make sends lowercase
  • b46a6e9 Update admin and templates
  • b4c9518 Update org revoke
  • 0d6a8b8 Fix sends expecting size to be a string on mobile
  • 4988e33 Convert two-factor providers to string
  • 3fe72ca Merge branch 'main' into remove_upcase

📊 Changes

37 files changed (+1953 additions, -2006 deletions)

View changed files

📝 src/api/admin.rs (+6 -6)
📝 src/api/core/accounts.rs (+232 -247)
📝 src/api/core/ciphers.rs (+180 -216)
📝 src/api/core/emergency_access.rs (+67 -71)
📝 src/api/core/events.rs (+25 -26)
📝 src/api/core/folders.rs (+13 -19)
📝 src/api/core/mod.rs (+29 -34)
📝 src/api/core/organizations.rs (+389 -379)
📝 src/api/core/public.rs (+38 -33)
📝 src/api/core/sends.rs (+74 -80)
📝 src/api/core/two_factor/authenticator.rs (+22 -33)
📝 src/api/core/two_factor/duo.rs (+30 -30)
📝 src/api/core/two_factor/email.rs (+35 -35)
📝 src/api/core/two_factor/mod.rs (+30 -30)
📝 src/api/core/two_factor/protected_actions.rs (+9 -8)
📝 src/api/core/two_factor/webauthn.rs (+74 -86)
📝 src/api/core/two_factor/yubikey.rs (+39 -37)
📝 src/api/identity.rs (+9 -7)
📝 src/api/mod.rs (+4 -9)
📝 src/db/models/attachment.rs (+7 -7)

...and 17 more files

📄 Description

This PR changes all the project's structs and API inputs and outputs from the old PascalCase format to the new camelCase format. At the moment the clients support both but that won't be a thing forever.

I haven't had the time to fully test this, but at least the basic things work. There may be some things missing, and I still need to review what we store in the db to make sure that there aren't any backwards compat issues.

This might also cause problems with other pending PRs so we can wait to merge it until they are dealt with.

Some fields that have special casing:

  • OTP in /accounts/verify-otp, as that's what the clients send. That said we also check otp
  • Keys and Nfc in yubikey, this is for backwards compat with older values stored on the server, now we serialize new versions to keys and nfc.
  • AttestationObject and clientDataJson in webauthn, as that's what the clients send. This is a bigger annoyance as it complicates the use of the webauthn crate.
  • Organization policies, this is for backwards compat with older values stored on the server, now we serialize new versions as camelCase.

Fixes #4656


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/4386 **Author:** [@dani-garcia](https://github.com/dani-garcia) **Created:** 2/28/2024 **Status:** ✅ Merged **Merged:** 6/23/2024 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `remove_upcase` --- ### 📝 Commits (9) - [`ccdcbc8`](https://github.com/dani-garcia/vaultwarden/commit/ccdcbc89ce7054afb7e7c7910a5ef5fb721a1605) Change API inputs/outputs and structs to camelCase - [`8daa359`](https://github.com/dani-garcia/vaultwarden/commit/8daa3593b15c76b5d7f74061b8f62b4d02dbdb3e) Fix fields and password history - [`716c9ad`](https://github.com/dani-garcia/vaultwarden/commit/716c9adc87b4ae444064cfb8bc327555f8fefa13) Use convert_json_key_lcase_first - [`813994e`](https://github.com/dani-garcia/vaultwarden/commit/813994e9baaee0c3365a82b73aa5b47a39a3f9a6) Make sends lowercase - [`b46a6e9`](https://github.com/dani-garcia/vaultwarden/commit/b46a6e932c60318af4c1a4c59649e905681551bc) Update admin and templates - [`b4c9518`](https://github.com/dani-garcia/vaultwarden/commit/b4c95189b834fa708d42d9378129ba596131fb4a) Update org revoke - [`0d6a8b8`](https://github.com/dani-garcia/vaultwarden/commit/0d6a8b8a3281fd0dd84759edc0ab8127d568ef86) Fix sends expecting size to be a string on mobile - [`4988e33`](https://github.com/dani-garcia/vaultwarden/commit/4988e3397461d2ea087fe22d08af5dcc29bed720) Convert two-factor providers to string - [`3fe72ca`](https://github.com/dani-garcia/vaultwarden/commit/3fe72cafbcbd94b14b486ac3019b439f90deb2a1) Merge branch 'main' into remove_upcase ### 📊 Changes **37 files changed** (+1953 additions, -2006 deletions) <details> <summary>View changed files</summary> 📝 `src/api/admin.rs` (+6 -6) 📝 `src/api/core/accounts.rs` (+232 -247) 📝 `src/api/core/ciphers.rs` (+180 -216) 📝 `src/api/core/emergency_access.rs` (+67 -71) 📝 `src/api/core/events.rs` (+25 -26) 📝 `src/api/core/folders.rs` (+13 -19) 📝 `src/api/core/mod.rs` (+29 -34) 📝 `src/api/core/organizations.rs` (+389 -379) 📝 `src/api/core/public.rs` (+38 -33) 📝 `src/api/core/sends.rs` (+74 -80) 📝 `src/api/core/two_factor/authenticator.rs` (+22 -33) 📝 `src/api/core/two_factor/duo.rs` (+30 -30) 📝 `src/api/core/two_factor/email.rs` (+35 -35) 📝 `src/api/core/two_factor/mod.rs` (+30 -30) 📝 `src/api/core/two_factor/protected_actions.rs` (+9 -8) 📝 `src/api/core/two_factor/webauthn.rs` (+74 -86) 📝 `src/api/core/two_factor/yubikey.rs` (+39 -37) 📝 `src/api/identity.rs` (+9 -7) 📝 `src/api/mod.rs` (+4 -9) 📝 `src/db/models/attachment.rs` (+7 -7) _...and 17 more files_ </details> ### 📄 Description This PR changes all the project's structs and API inputs and outputs from the old `PascalCase` format to the new `camelCase` format. At the moment the clients support both but that won't be a thing forever. I haven't had the time to fully test this, but at least the basic things work. There may be some things missing, and I still need to review what we store in the db to make sure that there aren't any backwards compat issues. This might also cause problems with other pending PRs so we can wait to merge it until they are dealt with. Some fields that have special casing: - `OTP` in `/accounts/verify-otp`, as that's what the clients send. That said we also check `otp` - `Keys` and `Nfc` in yubikey, this is for backwards compat with older values stored on the server, now we serialize new versions to `keys` and `nfc`. - `AttestationObject` and `clientDataJson` in webauthn, as that's what the clients send. This is a bigger annoyance as it complicates the use of the webauthn crate. - Organization policies, this is for backwards compat with older values stored on the server, now we serialize new versions as `camelCase`. Fixes #4656 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 09:58:51 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#3425
No description provided.