Skip to content

Commit 0476787

Browse files
committed
The spec says an enum can be a null
This is a breaking change for anyone on older versions. Relevant issue: github/rest-api-description#454 Signed-off-by: Jess Frazelle <jess@oxide.computer>
1 parent a057ebf commit 0476787

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/schema.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub struct StringType {
117117
#[serde(skip_serializing_if = "Option::is_none")]
118118
pub pattern: Option<String>,
119119
#[serde(rename = "enum", default, skip_serializing_if = "Vec::is_empty")]
120-
pub enumeration: Vec<String>,
120+
pub enumeration: Vec<Option<String>>,
121121
#[serde(skip_serializing_if = "Option::is_none")]
122122
pub min_length: Option<usize>,
123123
#[serde(skip_serializing_if = "Option::is_none")]

tests/test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ fn petstore_discriminated() {
180180
},
181181
schema_kind: SchemaKind::Type(Type::String(StringType {
182182
enumeration: vec![
183-
"clueless".to_owned(),
184-
"lazy".to_owned(),
185-
"adventurous".to_owned(),
186-
"aggressive".to_owned(),
183+
Some("clueless".to_owned()),
184+
Some("lazy".to_owned()),
185+
Some("adventurous".to_owned()),
186+
Some("aggressive".to_owned()),
187187
],
188188
..Default::default()
189189
})),

0 commit comments

Comments
 (0)