Skip to content

Commit

Permalink
s/sex/gender/g in test case
Browse files Browse the repository at this point in the history
Signed-off-by: Teo Klestrup Röijezon <[email protected]>
  • Loading branch information
nightkr committed Oct 14, 2022
1 parent 4c5e5a3 commit d2f90fb
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions kube-derive/tests/crd_schema_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,31 @@ enum ComplexEnum {
#[serde(rename_all = "camelCase")]
#[serde(untagged)]
enum UntaggedEnumPerson {
SexAndAge(SexAndAge),
SexAndDateOfBirth(SexAndDateOfBirth),
GenderAndAge(GenderAndAge),
GenderAndDateOfBirth(GenderAndDateOfBirth),
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, JsonSchema)]
#[serde(rename_all = "camelCase")]
struct SexAndAge {
/// Sex of the person
sex: Sex,
struct GenderAndAge {
/// Gender of the person
gender: Gender,
/// Age of the person in years
age: i32,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, JsonSchema)]
#[serde(rename_all = "camelCase")]
struct SexAndDateOfBirth {
/// Sex of the person
sex: Sex,
struct GenderAndDateOfBirth {
/// Gender of the person
gender: Gender,
/// Date of birth of the person as ISO 8601 date
date_of_birth: String,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, JsonSchema)]
#[serde(rename_all = "PascalCase")]
enum Sex {
enum Gender {
Female,
Male,
/// This variant has a comment!
Expand Down Expand Up @@ -134,9 +134,9 @@ fn test_serialized_matches_expected() {
nullable_with_default: None,
timestamp: DateTime::from_utc(NaiveDateTime::from_timestamp(0, 0), Utc),
complex_enum: ComplexEnum::VariantOne { int: 23 },
untagged_enum_person: UntaggedEnumPerson::SexAndAge(SexAndAge {
untagged_enum_person: UntaggedEnumPerson::GenderAndAge(GenderAndAge {
age: 42,
sex: Sex::Male,
gender: Gender::Male,
})
}))
.unwrap(),
Expand All @@ -159,7 +159,7 @@ fn test_serialized_matches_expected() {
},
"untaggedEnumPerson": {
"age": 42,
"sex": "Male"
"gender": "Male"
}
}
})
Expand Down Expand Up @@ -283,18 +283,18 @@ fn test_crd_schema_matches_expected() {
"type": "string",
"description": "Date of birth of the person as ISO 8601 date"
},
"sex": {
"gender": {
"type": "string",
"enum": ["Female", "Male", "Other"],
"description": "Sex of the person"
"description": "Gender of the person"
}
},
"anyOf": [
{
"required": ["age", "sex"]
"required": ["age", "gender"]
},
{
"required": ["dateOfBirth", "sex"]
"required": ["dateOfBirth", "gender"]
}
],
"description": "This is a untagged enum with a description"
Expand Down

0 comments on commit d2f90fb

Please sign in to comment.