Skip to content

Commit 10d2ff5

Browse files
authored
Fix CXF compilation errors (#423)
## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective The merge of #414 and #413 has created some conflicts leading to the main branch not building anymore. This PR should fix that. ## ⏰ 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 <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+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
1 parent b18e651 commit 10d2ff5

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

crates/bitwarden-exporters/src/cxf/identity.rs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use credential_exchange_format::{
22
AddressCredential, Credential, CustomFieldsCredential, DriversLicenseCredential, EditableField,
3-
EditableFieldString, IdentityDocumentCredential, PassportCredential, PersonNameCredential,
3+
EditableFieldString, EditableFieldValue, IdentityDocumentCredential, PassportCredential,
4+
PersonNameCredential,
45
};
56

67
use crate::{cxf::editable_field::create_field, Field, Identity};
@@ -421,18 +422,22 @@ impl From<Identity> for Vec<Credential> {
421422
}
422423

423424
// Handle unmapped Identity fields as custom fields
424-
let custom_fields: Vec<EditableField<EditableFieldString>> = [
425-
identity.email.as_ref().map(|email| EditableField {
426-
id: None,
427-
label: Some("Email".to_string()),
428-
value: EditableFieldString(email.clone()),
429-
extensions: None,
425+
let custom_fields: Vec<EditableFieldValue> = [
426+
identity.email.as_ref().map(|email| {
427+
EditableFieldValue::String(EditableField {
428+
id: None,
429+
label: Some("Email".to_string()),
430+
value: EditableFieldString(email.clone()),
431+
extensions: None,
432+
})
430433
}),
431-
identity.username.as_ref().map(|username| EditableField {
432-
id: None,
433-
label: Some("Username".to_string()),
434-
value: EditableFieldString(username.clone()),
435-
extensions: None,
434+
identity.username.as_ref().map(|username| {
435+
EditableFieldValue::String(EditableField {
436+
id: None,
437+
label: Some("Username".to_string()),
438+
value: EditableFieldString(username.clone()),
439+
extensions: None,
440+
})
436441
}),
437442
]
438443
.into_iter()
@@ -752,13 +757,21 @@ mod tests {
752757

753758
// Check email field
754759
let email_field = &custom_fields.fields[0];
755-
assert_eq!(email_field.label.as_ref().unwrap(), "Email");
756-
assert_eq!(email_field.value.0, "[email protected]");
760+
if let EditableFieldValue::String(email_field) = email_field {
761+
assert_eq!(email_field.label.as_ref().unwrap(), "Email");
762+
assert_eq!(email_field.value.0, "[email protected]");
763+
} else {
764+
panic!("Expected email field to be of type String");
765+
}
757766

758767
// Check username field
759768
let username_field = &custom_fields.fields[1];
760-
assert_eq!(username_field.label.as_ref().unwrap(), "Username");
761-
assert_eq!(username_field.value.0, "johndoe");
769+
if let EditableFieldValue::String(username_field) = username_field {
770+
assert_eq!(username_field.label.as_ref().unwrap(), "Username");
771+
assert_eq!(username_field.value.0, "johndoe");
772+
} else {
773+
panic!("Expected username field to be of type String");
774+
}
762775
} else {
763776
panic!("Expected CustomFields credential");
764777
}

0 commit comments

Comments
 (0)