@@ -932,6 +932,7 @@ pub enum Message {
932932 Hello ( Box < models:: Hello > ) ,
933933 Greeting ( Box < models:: Greeting > ) ,
934934 Goodbye ( Box < models:: Goodbye > ) ,
935+ SomethingCompletelyDifferent ( Box < models:: SomethingCompletelyDifferent > ) ,
935936}
936937
937938impl validator:: Validate for Message {
@@ -940,6 +941,7 @@ impl validator::Validate for Message {
940941 Self :: Hello ( x) => x. validate ( ) ,
941942 Self :: Greeting ( x) => x. validate ( ) ,
942943 Self :: Goodbye ( x) => x. validate ( ) ,
944+ Self :: SomethingCompletelyDifferent ( x) => x. validate ( ) ,
943945 }
944946 }
945947}
@@ -953,6 +955,7 @@ impl serde::Serialize for Message {
953955 Self :: Hello ( x) => x. serialize ( serializer) ,
954956 Self :: Greeting ( x) => x. serialize ( serializer) ,
955957 Self :: Goodbye ( x) => x. serialize ( serializer) ,
958+ Self :: SomethingCompletelyDifferent ( x) => x. serialize ( serializer) ,
956959 }
957960 }
958961}
@@ -972,6 +975,11 @@ impl From<models::Goodbye> for Message {
972975 Self :: Goodbye ( Box :: new ( value) )
973976 }
974977}
978+ impl From < models:: SomethingCompletelyDifferent > for Message {
979+ fn from ( value : models:: SomethingCompletelyDifferent ) -> Self {
980+ Self :: SomethingCompletelyDifferent ( Box :: new ( value) )
981+ }
982+ }
975983
976984/// Converts Query Parameters representation (style=form, explode=false) to a Message value
977985/// as specified in https://swagger.io/docs/specification/serialization/
@@ -983,3 +991,42 @@ impl std::str::FromStr for Message {
983991 serde_json:: from_str ( s)
984992 }
985993}
994+
995+ #[ derive( Debug , Clone , PartialEq , serde:: Serialize , serde:: Deserialize ) ]
996+ #[ serde( untagged) ]
997+ #[ allow( non_camel_case_types) ]
998+ pub enum SomethingCompletelyDifferent {
999+ VecOfObject ( Box < Vec < crate :: types:: Object > > ) ,
1000+ Object ( Box < crate :: types:: Object > ) ,
1001+ }
1002+
1003+ impl validator:: Validate for SomethingCompletelyDifferent {
1004+ fn validate ( & self ) -> std:: result:: Result < ( ) , validator:: ValidationErrors > {
1005+ match self {
1006+ Self :: VecOfObject ( _) => std:: result:: Result :: Ok ( ( ) ) ,
1007+ Self :: Object ( x) => x. validate ( ) ,
1008+ }
1009+ }
1010+ }
1011+
1012+ impl From < Vec < crate :: types:: Object > > for SomethingCompletelyDifferent {
1013+ fn from ( value : Vec < crate :: types:: Object > ) -> Self {
1014+ Self :: VecOfObject ( Box :: new ( value) )
1015+ }
1016+ }
1017+ impl From < crate :: types:: Object > for SomethingCompletelyDifferent {
1018+ fn from ( value : crate :: types:: Object ) -> Self {
1019+ Self :: Object ( Box :: new ( value) )
1020+ }
1021+ }
1022+
1023+ /// Converts Query Parameters representation (style=form, explode=false) to a SomethingCompletelyDifferent value
1024+ /// as specified in https://swagger.io/docs/specification/serialization/
1025+ /// Should be implemented in a serde deserializer
1026+ impl std:: str:: FromStr for SomethingCompletelyDifferent {
1027+ type Err = serde_json:: Error ;
1028+
1029+ fn from_str ( s : & str ) -> std:: result:: Result < Self , Self :: Err > {
1030+ serde_json:: from_str ( s)
1031+ }
1032+ }
0 commit comments