Skip to content

Commit f85b3a9

Browse files
author
Jean-Marc Le Roux
committed
fix(utoipa-gen): degenerate oneOf when using Option<_> + nullable = false + default
1 parent a77a017 commit f85b3a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

utoipa-gen/src/component.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ impl ComponentSchema {
13581358
// TODO: refs support `summary` field but currently there is no such field
13591359
// on schemas more over there is no way to distinct the `summary` from
13601360
// `description` of the ref. Should we consider supporting the summary?
1361-
let schema = if default.is_some() || nullable || title.is_some() {
1361+
let schema = if nullable {
13621362
composed_or_ref(quote_spanned! {type_path.span()=>
13631363
utoipa::openapi::schema::OneOfBuilder::new()
13641364
#nullable_item
@@ -1374,6 +1374,7 @@ impl ComponentSchema {
13741374
utoipa::openapi::schema::RefBuilder::new()
13751375
#description_stream
13761376
.ref_location_from_schema_name(#name_tokens)
1377+
#default_tokens
13771378
})
13781379
};
13791380

0 commit comments

Comments
 (0)