Skip to content

Commit

Permalink
Make CoreGenderClaim a string NewType instead of an enum
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ramos committed Sep 12, 2019
1 parent fdf8360 commit c2bccf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
18 changes: 5 additions & 13 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,21 +442,13 @@ pub enum CoreClientAuthMethod {
}
impl ClientAuthMethod for CoreClientAuthMethod {}

///
/// OpenID Connect Core gender claim.
///
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum CoreGenderClaim {
///
/// Female
///
Female,
new_type![
///
/// Male
/// OpenID Connect Core gender claim.
///
Male,
}
#[derive(Deserialize, Eq, Hash, Ord, PartialOrd, Serialize)]
CoreGenderClaim(String)
];
impl GenderClaim for CoreGenderClaim {}

///
Expand Down
2 changes: 1 addition & 1 deletion src/id_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ mod tests {
),
email: Some(EndUserEmail::new("[email protected]".to_string())),
email_verified: Some(true),
gender: Some(CoreGenderClaim::Male),
gender: Some(CoreGenderClaim::new("male".to_string())),
birthday: Some(EndUserBirthday::new("1956-05-12".to_string())),
zoneinfo: Some(EndUserTimezone::new("America/Los_Angeles".to_string())),
locale: Some(LanguageTag::new("en-US".to_string())),
Expand Down

0 comments on commit c2bccf9

Please sign in to comment.