@@ -1338,15 +1338,20 @@ impl std::ops::DerefMut for Error {
13381338pub struct FormTestRequest {
13391339 #[ serde( rename = "requiredArray" ) ]
13401340 #[ validate( custom( function = "check_xss_vec_string" ) ) ]
1341- #[ serde( skip_serializing_if = "Option::is_none" ) ]
1342- pub required_array : Option < Vec < String > > ,
1341+ pub required_array : Vec < String > ,
1342+
1343+ /// Note: inline enums are not fully supported by openapi-generator
1344+ #[ serde( rename = "enum_field" ) ]
1345+ #[ validate( custom( function = "check_xss_string" ) ) ]
1346+ pub enum_field : String ,
13431347}
13441348
13451349impl FormTestRequest {
13461350 #[ allow( clippy:: new_without_default, clippy:: too_many_arguments) ]
1347- pub fn new ( ) -> FormTestRequest {
1351+ pub fn new ( required_array : Vec < String > , enum_field : String ) -> FormTestRequest {
13481352 FormTestRequest {
1349- required_array : None ,
1353+ required_array,
1354+ enum_field,
13501355 }
13511356 }
13521357}
@@ -1356,18 +1361,18 @@ impl FormTestRequest {
13561361/// Should be implemented in a serde serializer
13571362impl std:: fmt:: Display for FormTestRequest {
13581363 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
1359- let params: Vec < Option < String > > =
1360- vec ! [ self . required_array . as_ref ( ) . map ( |required_array| {
1361- [
1362- "requiredArray" . to_string ( ) ,
1363- required_array
1364- . iter ( )
1365- . map ( |x| x . to_string ( ) )
1366- . collect :: < Vec <_>> ( )
1367- . join ( "," ) ,
1368- ]
1369- . join ( "," )
1370- } ) ] ;
1364+ let params: Vec < Option < String > > = vec ! [
1365+ Some ( "requiredArray" . to_string ( ) ) ,
1366+ Some (
1367+ self . required_array
1368+ . iter ( )
1369+ . map ( |x| x . to_string ( ) )
1370+ . collect :: < Vec <_>> ( )
1371+ . join ( "," ) ,
1372+ ) ,
1373+ Some ( "enum_field" . to_string ( ) ) ,
1374+ Some ( self . enum_field . to_string ( ) ) ,
1375+ ] ;
13711376
13721377 write ! (
13731378 f,
@@ -1389,6 +1394,7 @@ impl std::str::FromStr for FormTestRequest {
13891394 #[ allow( dead_code) ]
13901395 struct IntermediateRep {
13911396 pub required_array : Vec < Vec < String > > ,
1397+ pub enum_field : Vec < String > ,
13921398 }
13931399
13941400 let mut intermediate_rep = IntermediateRep :: default ( ) ;
@@ -1416,6 +1422,10 @@ impl std::str::FromStr for FormTestRequest {
14161422 . to_string ( ) ,
14171423 ) ;
14181424 }
1425+ #[ allow( clippy:: redundant_clone) ]
1426+ "enum_field" => intermediate_rep. enum_field . push (
1427+ <String as std:: str:: FromStr >:: from_str ( val) . map_err ( |x| x. to_string ( ) ) ?,
1428+ ) ,
14191429 _ => {
14201430 return std:: result:: Result :: Err (
14211431 "Unexpected key while parsing FormTestRequest" . to_string ( ) ,
@@ -1430,7 +1440,16 @@ impl std::str::FromStr for FormTestRequest {
14301440
14311441 // Use the intermediate representation to return the struct
14321442 std:: result:: Result :: Ok ( FormTestRequest {
1433- required_array : intermediate_rep. required_array . into_iter ( ) . next ( ) ,
1443+ required_array : intermediate_rep
1444+ . required_array
1445+ . into_iter ( )
1446+ . next ( )
1447+ . ok_or_else ( || "requiredArray missing in FormTestRequest" . to_string ( ) ) ?,
1448+ enum_field : intermediate_rep
1449+ . enum_field
1450+ . into_iter ( )
1451+ . next ( )
1452+ . ok_or_else ( || "enum_field missing in FormTestRequest" . to_string ( ) ) ?,
14341453 } )
14351454 }
14361455}
@@ -1815,6 +1834,42 @@ impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<MyIdList> {
18151834 }
18161835}
18171836
1837+ /// An object with no type
1838+ #[ derive( Debug , Clone , PartialEq , serde:: Serialize , serde:: Deserialize ) ]
1839+ #[ cfg_attr( feature = "conversion" , derive( frunk:: LabelledGeneric ) ) ]
1840+ pub struct NoTypeObject ( pub crate :: types:: Object ) ;
1841+
1842+ impl validator:: Validate for NoTypeObject {
1843+ fn validate ( & self ) -> std:: result:: Result < ( ) , validator:: ValidationErrors > {
1844+ std:: result:: Result :: Ok ( ( ) )
1845+ }
1846+ }
1847+
1848+ impl std:: convert:: From < crate :: types:: Object > for NoTypeObject {
1849+ fn from ( x : crate :: types:: Object ) -> Self {
1850+ NoTypeObject ( x)
1851+ }
1852+ }
1853+
1854+ impl std:: convert:: From < NoTypeObject > for crate :: types:: Object {
1855+ fn from ( x : NoTypeObject ) -> Self {
1856+ x. 0
1857+ }
1858+ }
1859+
1860+ impl std:: ops:: Deref for NoTypeObject {
1861+ type Target = crate :: types:: Object ;
1862+ fn deref ( & self ) -> & crate :: types:: Object {
1863+ & self . 0
1864+ }
1865+ }
1866+
1867+ impl std:: ops:: DerefMut for NoTypeObject {
1868+ fn deref_mut ( & mut self ) -> & mut crate :: types:: Object {
1869+ & mut self . 0
1870+ }
1871+ }
1872+
18181873#[ derive( Debug , Clone , PartialEq , PartialOrd , serde:: Serialize , serde:: Deserialize ) ]
18191874#[ cfg_attr( feature = "conversion" , derive( frunk:: LabelledGeneric ) ) ]
18201875pub struct NullableObject ( pub String ) ;
0 commit comments