4646import java .util .*;
4747import java .util .regex .Matcher ;
4848import java .util .regex .Pattern ;
49+ import java .util .stream .Collectors ;
4950
5051import static org .openapitools .codegen .utils .StringUtils .camelize ;
5152import static org .openapitools .codegen .utils .StringUtils .underscore ;
@@ -222,7 +223,7 @@ public RustServerCodegen() {
222223 */
223224 supportingFiles .add (new SupportingFile ("openapi.mustache" , "api" , "openapi.yaml" ));
224225 supportingFiles .add (new SupportingFile ("Cargo.mustache" , "" , "Cargo.toml" ));
225- supportingFiles .add (new SupportingFile ("cargo-config" , ".cargo" , "config" ));
226+ supportingFiles .add (new SupportingFile ("cargo-config" , ".cargo" , "config.toml " ));
226227 supportingFiles .add (new SupportingFile ("gitignore" , "" , ".gitignore" ));
227228 supportingFiles .add (new SupportingFile ("lib.mustache" , "src" , "lib.rs" ));
228229 supportingFiles .add (new SupportingFile ("context.mustache" , "src" , "context.rs" ));
@@ -233,7 +234,6 @@ public RustServerCodegen() {
233234 supportingFiles .add (new SupportingFile ("server-server_auth.mustache" , "src/server" , "server_auth.rs" ));
234235 supportingFiles .add (new SupportingFile ("client-mod.mustache" , "src/client" , "mod.rs" ));
235236 supportingFiles .add (new SupportingFile ("example-server-main.mustache" , "examples/server" , "main.rs" ));
236- supportingFiles .add (new SupportingFile ("example-server-tokio-io.rs" , "examples/server" , "tokio_io.rs" ));
237237 supportingFiles .add (new SupportingFile ("example-server-server.mustache" , "examples/server" , "server.rs" ));
238238 supportingFiles .add (new SupportingFile ("example-server-auth.mustache" , "examples/server" , "server_auth.rs" ));
239239 supportingFiles .add (new SupportingFile ("example-client-main.mustache" , "examples/client" , "main.rs" ));
@@ -1532,7 +1532,16 @@ private void processParam(CodegenParameter param, CodegenOperation op) {
15321532 }
15331533 } else if (param .isArray ) {
15341534 param .vendorExtensions .put ("x-format-string" , "{:?}" );
1535- example = (param .example != null ) ? param .example : "&Vec::new()" ;
1535+ if (param .items .isString ) {
1536+ // We iterate through the list of string and ensure they end up in the format vec!["example".to_string()]
1537+ example = (param .example != null )
1538+ ? "&vec![" + Arrays .stream (param .example .replace ("[" , "" ).replace ("]" , "" ).split ("," ))
1539+ .map (item -> item + ".to_string()" )
1540+ .collect (Collectors .joining (", " )) + "]"
1541+ : "&Vec::new()" ;
1542+ } else {
1543+ example = (param .example != null ) ? param .example : "&Vec::new()" ;
1544+ }
15361545 } else {
15371546 param .vendorExtensions .put ("x-format-string" , "{:?}" );
15381547 if (param .example != null ) {
0 commit comments