From 509453d00cb5756f86a4cf4887749b31fc8274e0 Mon Sep 17 00:00:00 2001 From: Feiryn <98115666+Feiryn@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:44:35 +0100 Subject: [PATCH] Add default to Example string fields --- utoipa/src/openapi/example.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utoipa/src/openapi/example.rs b/utoipa/src/openapi/example.rs index 2374196f..b233aa56 100644 --- a/utoipa/src/openapi/example.rs +++ b/utoipa/src/openapi/example.rs @@ -32,12 +32,12 @@ builder! { #[serde(rename_all = "camelCase")] pub struct Example { /// Short description for the [`Example`]. - #[serde(skip_serializing_if = "String::is_empty")] + #[serde(skip_serializing_if = "String::is_empty", default)] pub summary: String, /// Long description for the [`Example`]. Value supports markdown syntax for rich text /// representation. - #[serde(skip_serializing_if = "String::is_empty")] + #[serde(skip_serializing_if = "String::is_empty", default)] pub description: String, /// Embedded literal example value. [`Example::value`] and [`Example::external_value`] are @@ -48,7 +48,7 @@ builder! { /// An URI that points to a literal example value. [`Example::external_value`] provides the /// capability to references an example that cannot be easily included in JSON or YAML. /// [`Example::value`] and [`Example::external_value`] are mutually exclusive. - #[serde(skip_serializing_if = "String::is_empty")] + #[serde(skip_serializing_if = "String::is_empty", default)] pub external_value: String, } }