Skip to content

Commit 60ce7ac

Browse files
authored
Remove json schema when it's not used (#253)
We don't use json schema for the password manager sdk. Let's remove it and if we ever need it we can add it back.
1 parent 0c2d3e2 commit 60ce7ac

File tree

33 files changed

+77
-115
lines changed

33 files changed

+77
-115
lines changed

Cargo.lock

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bitwarden-core/src/admin_console/policy.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use std::collections::HashMap;
22

33
use bitwarden_api_api::models::PolicyResponseModel;
4-
use schemars::JsonSchema;
54
use serde::{Deserialize, Serialize};
65
use serde_repr::{Deserialize_repr, Serialize_repr};
76
use uuid::Uuid;
87

98
use crate::{require, MissingFieldError};
109

1110
/// Represents a policy that can be applied to an organization.
12-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
11+
#[derive(Serialize, Deserialize, Debug)]
1312
pub struct Policy {
1413
id: Uuid,
1514
organization_id: Uuid,
@@ -18,7 +17,7 @@ pub struct Policy {
1817
enabled: bool,
1918
}
2019

21-
#[derive(Serialize_repr, Deserialize_repr, Debug, JsonSchema)]
20+
#[derive(Serialize_repr, Deserialize_repr, Debug)]
2221
#[repr(u8)]
2322
pub enum PolicyType {
2423
/// Requires users to have 2fa enabled

crates/bitwarden-core/src/auth/password/policy.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use schemars::JsonSchema;
2-
31
/// Validate the provided password passes the provided Master Password Requirements Policy.
42
pub(crate) fn satisfies_policy(
53
password: String,
@@ -33,7 +31,7 @@ pub(crate) fn satisfies_policy(
3331
true
3432
}
3533

36-
#[derive(Debug, JsonSchema)]
34+
#[derive(Debug)]
3735
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
3836
#[allow(dead_code)]
3937
pub struct MasterPasswordPolicyOptions {

crates/bitwarden-core/src/auth/register.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ use bitwarden_api_identity::{
55
use bitwarden_crypto::{
66
default_pbkdf2_iterations, CryptoError, HashPurpose, Kdf, MasterKey, RsaKeyPair,
77
};
8-
use schemars::JsonSchema;
98
use serde::{Deserialize, Serialize};
109
use thiserror::Error;
1110

1211
use crate::{ApiError, Client};
1312

14-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
13+
#[derive(Serialize, Deserialize, Debug)]
1514
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1615
pub struct RegisterRequest {
1716
pub email: String,

crates/bitwarden-core/src/mobile/crypto.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use bitwarden_crypto::{
1111
AsymmetricCryptoKey, CryptoError, EncString, Kdf, KeyDecryptable, KeyEncryptable, MasterKey,
1212
SymmetricCryptoKey, UnsignedSharedKey, UserKey,
1313
};
14-
use schemars::JsonSchema;
1514
use serde::{Deserialize, Serialize};
1615
#[cfg(feature = "wasm")]
1716
use {tsify_next::Tsify, wasm_bindgen::prelude::*};
@@ -35,7 +34,7 @@ pub enum MobileCryptoError {
3534
}
3635

3736
/// State used for initializing the user cryptographic state.
38-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
37+
#[derive(Serialize, Deserialize, Debug)]
3938
#[serde(rename_all = "camelCase", deny_unknown_fields)]
4039
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
4140
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
@@ -51,7 +50,7 @@ pub struct InitUserCryptoRequest {
5150
}
5251

5352
/// The crypto method used to initialize the user cryptographic state.
54-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
53+
#[derive(Serialize, Deserialize, Debug)]
5554
#[serde(rename_all = "camelCase", deny_unknown_fields)]
5655
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
5756
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
@@ -102,7 +101,7 @@ pub enum InitUserCryptoMethod {
102101
}
103102

104103
/// Auth requests supports multiple initialization methods.
105-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
104+
#[derive(Serialize, Deserialize, Debug)]
106105
#[serde(rename_all = "camelCase", deny_unknown_fields)]
107106
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
108107
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
@@ -222,7 +221,7 @@ pub async fn initialize_user_crypto(
222221
}
223222

224223
/// Represents the request to initialize the user's organizational cryptographic state.
225-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
224+
#[derive(Serialize, Deserialize, Debug)]
226225
#[serde(rename_all = "camelCase", deny_unknown_fields)]
227226
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
228227
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
@@ -252,7 +251,7 @@ pub(super) async fn get_user_encryption_key(client: &Client) -> Result<String, M
252251
}
253252

254253
/// Response from the `update_password` function
255-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
254+
#[derive(Serialize, Deserialize, Debug)]
256255
#[serde(rename_all = "camelCase", deny_unknown_fields)]
257256
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
258257
pub struct UpdatePasswordResponse {
@@ -301,7 +300,7 @@ pub(super) fn update_password(
301300
}
302301

303302
/// Request for deriving a pin protected user key
304-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
303+
#[derive(Serialize, Deserialize, Debug)]
305304
#[serde(rename_all = "camelCase", deny_unknown_fields)]
306305
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
307306
pub struct DerivePinKeyResponse {
@@ -438,7 +437,7 @@ pub(super) fn derive_key_connector(
438437
}
439438

440439
/// Response from the `make_key_pair` function
441-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
440+
#[derive(Serialize, Deserialize, Debug)]
442441
#[serde(rename_all = "camelCase", deny_unknown_fields)]
443442
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
444443
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
@@ -461,7 +460,7 @@ pub(super) fn make_key_pair(user_key: String) -> Result<MakeKeyPairResponse, Cry
461460
}
462461

463462
/// Request for `verify_asymmetric_keys`.
464-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
463+
#[derive(Serialize, Deserialize, Debug)]
465464
#[serde(rename_all = "camelCase", deny_unknown_fields)]
466465
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
467466
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
@@ -475,7 +474,7 @@ pub struct VerifyAsymmetricKeysRequest {
475474
}
476475

477476
/// Response for `verify_asymmetric_keys`.
478-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
477+
#[derive(Serialize, Deserialize, Debug)]
479478
#[serde(rename_all = "camelCase", deny_unknown_fields)]
480479
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
481480
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]

crates/bitwarden-core/src/platform/generate_fingerprint.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
55
use base64::{engine::general_purpose::STANDARD, Engine};
66
use bitwarden_crypto::fingerprint;
7-
use schemars::JsonSchema;
87
use serde::{Deserialize, Serialize};
98
use thiserror::Error;
109

1110
use crate::{key_management::AsymmetricKeyId, MissingPrivateKeyError, VaultLockedError};
1211

1312
/// Request to generate a fingerprint.
14-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
13+
#[derive(Serialize, Deserialize, Debug)]
1514
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1615
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
1716
pub struct FingerprintRequest {
@@ -24,7 +23,7 @@ pub struct FingerprintRequest {
2423
/// Response containing a generated fingerprint.
2524
///
2625
/// TODO: We should attempt to remove this and just return a string.
27-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
26+
#[derive(Serialize, Deserialize, Debug)]
2827
#[serde(rename_all = "camelCase", deny_unknown_fields)]
2928
pub struct FingerprintResponse {
3029
/// The generated fingerprint.

crates/bitwarden-core/src/platform/get_user_api_key.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use bitwarden_api_api::{
2020
};
2121
use bitwarden_crypto::{HashPurpose, MasterKey};
2222
use log::{debug, info};
23-
use schemars::JsonSchema;
2423
use serde::{Deserialize, Serialize};
2524
use thiserror::Error;
2625

@@ -101,7 +100,7 @@ fn build_secret_verification_request(
101100
}
102101

103102
/// The response from the server when requesting the user's API key.
104-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
103+
#[derive(Serialize, Deserialize, Debug)]
105104
#[serde(rename_all = "camelCase", deny_unknown_fields)]
106105
pub struct UserApiKeyResponse {
107106
/// The user's API key, which represents the client_secret portion of an oauth request.

crates/bitwarden-core/src/platform/secret_verification_request.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use schemars::JsonSchema;
21
use serde::{Deserialize, Serialize};
32

43
/// Request to verify a user's secret.
5-
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
4+
#[derive(Serialize, Deserialize, Debug)]
65
#[serde(rename_all = "camelCase", deny_unknown_fields)]
76
pub struct SecretVerificationRequest {
87
/// The user's master password to use for user verification. If supplied, this will be used for

crates/bitwarden-crypto/src/keys/master_key.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::pin::Pin;
33
use base64::{engine::general_purpose::STANDARD, Engine};
44
use generic_array::{typenum::U32, GenericArray};
55
use rand::Rng;
6-
use schemars::JsonSchema;
76
use zeroize::{Zeroize, Zeroizing};
87

98
use super::{
@@ -15,7 +14,7 @@ use crate::{
1514
CryptoError, EncString, KeyDecryptable, Result, SymmetricCryptoKey, UserKey,
1615
};
1716

18-
#[derive(Copy, Clone, JsonSchema)]
17+
#[derive(Copy, Clone)]
1918
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
2019
pub enum HashPurpose {
2120
ServerAuthorization = 1,

crates/bitwarden-exporters/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ chrono = { workspace = true, features = ["std"] }
3030
credential-exchange-format = ">=0.1, <0.2"
3131
csv = "1.3.0"
3232
num-traits = ">=0.2, <0.3"
33-
schemars = { workspace = true }
3433
serde = { workspace = true }
3534
serde_json = { workspace = true }
3635
thiserror = { workspace = true }

0 commit comments

Comments
 (0)