Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ impl std::ops::DerefMut for {{{classname}}} {
}
}

{{^hasConflictingModelNames}}
#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for {{{classname}}} {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
{{/hasConflictingModelNames}}
{{#exts.x-to-string-support}}
{{#exts.x-is-string}}
impl std::fmt::Display for {{{classname}}} {
Expand Down Expand Up @@ -364,23 +375,24 @@ pub struct {{{classname}}} {
)]
{{/hasConflictingModelNames}}
{{/hasValidation}}
{{#required}}
{{^hasConflictingModelNames}}{{>validate}}{{/hasConflictingModelNames}}
{{^hasConflictingModelNames}}
{{#exts.x-needs-nested-validation}}
#[cfg_attr(feature = "validate", validate)]
{{^minLength}}{{^maxLength}}{{^minItems}}{{^maxItems}}#[cfg_attr(feature = "validate", validate)]{{/maxItems}}{{/minItems}}{{/maxLength}}{{/minLength}}
{{/exts.x-needs-nested-validation}}
{{/hasConflictingModelNames}}
{{#required}}
pub {{{name}}}: {{{dataType}}},
{{/required}}
{{^required}}
{{#isNullable}}
#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]
{{/isNullable}}
{{^hasConflictingModelNames}}{{>validate}}{{/hasConflictingModelNames}}
{{^hasConflictingModelNames}}
{{#exts.x-needs-nested-validation}}
#[cfg_attr(feature = "validate", validate)]
{{^minLength}}{{^maxLength}}{{^minItems}}{{^maxItems}}#[cfg_attr(feature = "validate", validate)]{{/maxItems}}{{/minItems}}{{/maxLength}}{{/minLength}}
{{/exts.x-needs-nested-validation}}
{{/hasConflictingModelNames}}
#[serde(skip_serializing_if="Option::is_none")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use serde_valid::Validate;
pub struct MultipartRelatedRequest {
#[serde(rename = "object_field")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub object_field: Option<models::MultipartRequestObjectField>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ impl AdditionalPropertiesWithList {
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct AdditionalPropertiesWithNullable {
#[serde(rename = "nullableString")]

#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]

#[serde(skip_serializing_if="Option::is_none")]
pub nullable_string: Option<swagger::Nullable<String>>,

Expand Down Expand Up @@ -3446,30 +3446,30 @@ pub struct NullableTest {
pub nullable: swagger::Nullable<String>,

#[serde(rename = "nullableWithNullDefault")]

#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]

#[serde(skip_serializing_if="Option::is_none")]
pub nullable_with_null_default: Option<swagger::Nullable<String>>,

#[serde(rename = "nullableWithPresentDefault")]

#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]

#[serde(skip_serializing_if="Option::is_none")]
pub nullable_with_present_default: Option<swagger::Nullable<String>>,

#[serde(rename = "nullableWithNoDefault")]

#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]

#[serde(skip_serializing_if="Option::is_none")]
pub nullable_with_no_default: Option<swagger::Nullable<String>>,

#[serde(rename = "nullableArray")]

#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]

#[serde(skip_serializing_if="Option::is_none")]
pub nullable_array: Option<swagger::Nullable<Vec<String>>>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1096,14 +1096,12 @@ pub struct ArrayTest {

#[serde(rename = "array_array_of_model")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub array_array_of_model: Option<Vec<Vec<models::ReadOnlyFirst>>>,

#[serde(rename = "array_of_enum")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub array_of_enum: Option<Vec<models::MapTestMapMapOfEnumValueValue>>,
Expand Down Expand Up @@ -2641,21 +2639,18 @@ impl DollarSpecialLeftSquareBracketModelNameRightSquareBracket {
pub struct EnumArrays {
#[serde(rename = "just_symbol")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub just_symbol: Option<models::EnumArraysJustSymbol>,

#[serde(rename = "array_enum")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub array_enum: Option<Vec<models::EnumArraysArrayEnumInner>>,

#[serde(rename = "array_array_enum")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub array_array_enum: Option<Vec<Vec<models::EnumArraysArrayArrayEnumInnerInner>>>,
Expand Down Expand Up @@ -3329,7 +3324,6 @@ impl EnumClass {
pub struct EnumTest {
#[serde(rename = "enum_string")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub enum_string: Option<models::EnumTestEnumString>,
Expand All @@ -3341,21 +3335,18 @@ pub struct EnumTest {

#[serde(rename = "enum_integer")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub enum_integer: Option<models::EnumTestEnumInteger>,

#[serde(rename = "enum_number")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub enum_number: Option<models::TestEnumParametersEnumQueryDoubleParameter>,

#[serde(rename = "outerEnum")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub outer_enum: Option<models::OuterEnum>,
Expand Down Expand Up @@ -4663,14 +4654,12 @@ pub struct MapTest {

#[serde(rename = "map_map_of_enum")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub map_map_of_enum: Option<std::collections::HashMap<String, std::collections::HashMap<String, models::MapTestMapMapOfEnumValueValue>>>,

#[serde(rename = "map_of_enum_string")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub map_of_enum_string: Option<std::collections::HashMap<String, models::MapTestMapMapOfEnumValueValue>>,
Expand Down Expand Up @@ -4980,7 +4969,6 @@ pub struct MixedPropertiesAndAdditionalPropertiesClass {

#[serde(rename = "map")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub map: Option<std::collections::HashMap<String, models::Animal>>,
Expand Down Expand Up @@ -5735,7 +5723,6 @@ impl NumberOnly {
pub struct ObjectContainingObjectWithOnlyAdditionalProperties {
#[serde(rename = "inner")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub inner: Option<models::ObjectWithOnlyAdditionalProperties>,
Expand Down Expand Up @@ -5930,6 +5917,15 @@ impl std::ops::DerefMut for ObjectWithOnlyAdditionalProperties {
}
}

#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for ObjectWithOnlyAdditionalProperties {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
/// Converts the ObjectWithOnlyAdditionalProperties value to the Query Parameters representation (style=form, explode=false)
/// specified in <https://swagger.io/docs/specification/serialization/>
/// Should be implemented in a serde serializer
Expand Down Expand Up @@ -6064,7 +6060,6 @@ pub struct Order {

#[serde(rename = "status")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<models::OrderStatus>,
Expand Down Expand Up @@ -6442,6 +6437,15 @@ impl std::ops::DerefMut for OuterBoolean {
}
}

#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for OuterBoolean {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
/// Converts the OuterBoolean value to the Query Parameters representation (style=form, explode=false)
/// specified in <https://swagger.io/docs/specification/serialization/>
/// Should be implemented in a serde serializer
Expand Down Expand Up @@ -6914,6 +6918,15 @@ impl std::ops::DerefMut for OuterNumber {
}
}

#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for OuterNumber {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
/// Converts the OuterNumber value to the Query Parameters representation (style=form, explode=false)
/// specified in <https://swagger.io/docs/specification/serialization/>
/// Should be implemented in a serde serializer
Expand Down Expand Up @@ -7056,6 +7069,15 @@ impl std::ops::DerefMut for OuterString {
}
}

#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for OuterString {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
impl std::fmt::Display for OuterString {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.clone())
Expand Down Expand Up @@ -7167,7 +7189,6 @@ pub struct Pet {

#[serde(rename = "category")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub category: Option<models::Category>,
Expand All @@ -7182,14 +7203,12 @@ pub struct Pet {

#[serde(rename = "tags")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub tags: Option<Vec<models::Tag>>,

#[serde(rename = "status")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<models::PetStatus>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use serde_valid::Validate;
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct ANullableContainer {
#[serde(rename = "NullableThing")]

#[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")]
#[serde(default = "swagger::nullable_format::default_optional_nullable")]

#[serde(skip_serializing_if="Option::is_none")]
pub nullable_thing: Option<swagger::Nullable<String>>,

Expand Down Expand Up @@ -214,6 +214,15 @@ impl std::ops::DerefMut for AdditionalPropertiesObject {
}
}

#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for AdditionalPropertiesObject {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
/// Converts the AdditionalPropertiesObject value to the Query Parameters representation (style=form, explode=false)
/// specified in <https://swagger.io/docs/specification/serialization/>
/// Should be implemented in a serde serializer
Expand Down Expand Up @@ -996,7 +1005,6 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
pub struct ObjectOfObjects {
#[serde(rename = "inner")]

#[cfg_attr(feature = "validate", validate)]
#[cfg_attr(feature = "validate", validate)]
#[serde(skip_serializing_if="Option::is_none")]
pub inner: Option<models::ObjectOfObjectsInner>,
Expand Down Expand Up @@ -1525,6 +1533,15 @@ impl std::ops::DerefMut for UnnamedReference {
}
}

#[cfg(feature = "validate")]
impl serde_valid::validation::ValidateCompositedMinLength for UnnamedReference {
fn validate_composited_min_length(
&self,
_min_length: usize,
) -> Result<(), serde_valid::validation::Composited<serde_valid::validation::error::MinLengthError>> {
Ok(())
}
}
/// Converts the UnnamedReference value to the Query Parameters representation (style=form, explode=false)
/// specified in <https://swagger.io/docs/specification/serialization/>
/// Should be implemented in a serde serializer
Expand Down
Loading