File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/rust
samples/client/petstore/rust
hyper0x/petstore/src/apis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,25 @@ impl<C: Connect>{{{classname}}} for {{{classname}}}Client<C>
7878 let query_value = s.iter().map(|s| s.to_string()).collect::<Vec <String >>().join(",");
7979 { {/isArray} }
8080 { {^isArray} }
81+ { {#isPrimitiveType} }
8182 let query_value = s.to_string();
83+ { {/isPrimitiveType} }
84+ { {^isPrimitiveType} }
85+ { {#isEnum} }
86+ let query_value = s.to_string();
87+ { {/isEnum} }
88+ { {^isEnum} }
89+ { {#isEnumRef} }
90+ let query_value = s.to_string();
91+ { {/isEnumRef} }
92+ { {^isEnumRef} }
93+ let query_value = match serde_json::to_string(s) {
94+ Ok(value) => value,
95+ Err(e) => return Box::pin(futures::future::err(Error::Serde(e))),
96+ } ;
97+ { {/isEnumRef} }
98+ { {/isEnum} }
99+ { {/isPrimitiveType} }
82100 { {/isArray} }
83101 req = req.with_query_param("{ {{baseName} }}".to_string(), query_value);
84102 }
Original file line number Diff line number Diff line change @@ -77,7 +77,25 @@ impl<C: hyper::client::connect::Connect>{{{classname}}} for {{{classname}}}Clien
7777 let query_value = s.iter().map(|s| s.to_string()).collect::<Vec <String >>().join(",");
7878 { {/isArray} }
7979 { {^isArray} }
80+ { {#isPrimitiveType} }
8081 let query_value = s.to_string();
82+ { {/isPrimitiveType} }
83+ { {^isPrimitiveType} }
84+ { {#isEnum} }
85+ let query_value = s.to_string();
86+ { {/isEnum} }
87+ { {^isEnum} }
88+ { {#isEnumRef} }
89+ let query_value = s.to_string();
90+ { {/isEnumRef} }
91+ { {^isEnumRef} }
92+ let query_value = match serde_json::to_string(s) {
93+ Ok(value) => value,
94+ Err(e) => return Box::pin(futures::future::err(Error::Serde(e))),
95+ } ;
96+ { {/isEnumRef} }
97+ { {/isEnum} }
98+ { {/isPrimitiveType} }
8199 { {/isArray} }
82100 req = req.with_query_param("{ {{baseName} }}".to_string(), query_value);
83101 }
Original file line number Diff line number Diff line change @@ -118,7 +118,10 @@ impl<C: Connect>PetApi for PetApiClient<C>
118118 let mut req = __internal_request:: Request :: new ( hyper:: Method :: POST , "/pets/explode" . to_string ( ) )
119119 ;
120120 if let Some ( ref s) = page_explode {
121- let query_value = s. to_string ( ) ;
121+ let query_value = match serde_json:: to_string ( s) {
122+ Ok ( value) => value,
123+ Err ( e) => return Box :: pin ( futures:: future:: err ( Error :: Serde ( e) ) ) ,
124+ } ;
122125 req = req. with_query_param ( "pageExplode" . to_string ( ) , query_value) ;
123126 }
124127
@@ -130,7 +133,10 @@ impl<C: Connect>PetApi for PetApiClient<C>
130133 let mut req = __internal_request:: Request :: new ( hyper:: Method :: POST , "/pets" . to_string ( ) )
131134 ;
132135 if let Some ( ref s) = page {
133- let query_value = s. to_string ( ) ;
136+ let query_value = match serde_json:: to_string ( s) {
137+ Ok ( value) => value,
138+ Err ( e) => return Box :: pin ( futures:: future:: err ( Error :: Serde ( e) ) ) ,
139+ } ;
134140 req = req. with_query_param ( "page" . to_string ( ) , query_value) ;
135141 }
136142
Original file line number Diff line number Diff line change @@ -117,7 +117,10 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
117117 let mut req = __internal_request:: Request :: new ( hyper:: Method :: POST , "/pets/explode" . to_string ( ) )
118118 ;
119119 if let Some ( ref s) = page_explode {
120- let query_value = s. to_string ( ) ;
120+ let query_value = match serde_json:: to_string ( s) {
121+ Ok ( value) => value,
122+ Err ( e) => return Box :: pin ( futures:: future:: err ( Error :: Serde ( e) ) ) ,
123+ } ;
121124 req = req. with_query_param ( "pageExplode" . to_string ( ) , query_value) ;
122125 }
123126
@@ -129,7 +132,10 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
129132 let mut req = __internal_request:: Request :: new ( hyper:: Method :: POST , "/pets" . to_string ( ) )
130133 ;
131134 if let Some ( ref s) = page {
132- let query_value = s. to_string ( ) ;
135+ let query_value = match serde_json:: to_string ( s) {
136+ Ok ( value) => value,
137+ Err ( e) => return Box :: pin ( futures:: future:: err ( Error :: Serde ( e) ) ) ,
138+ } ;
133139 req = req. with_query_param ( "page" . to_string ( ) , query_value) ;
134140 }
135141
You can’t perform that action at this time.
0 commit comments