From c28875cd104a41498f0c4c361156cb09afe0787c Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 28 May 2020 22:12:34 +0800 Subject: [PATCH] better struct alias in rust --- .../src/main/resources/rust/reqwest/api.mustache | 6 +++--- .../src/main/resources/rust/reqwest/api_mod.mustache | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache index 48bd7cc1524d..bd5a840215c3 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -27,7 +27,7 @@ impl {{{classname}}}Client { {{#-first}} /// struct for passing parameters to the method `{{operationId}}` #[derive(Clone, Debug)] -pub struct {{{classname}}}{{{operationIdCamelCase}}}Params { +pub struct {{{operationIdCamelCase}}}Params { {{/-first}} {{#description}} /// {{{.}}} @@ -46,7 +46,7 @@ pub trait {{{classname}}} { {{#operations}} {{#operation}} {{#vendorExtensions.x-group-parameters}} - fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{classname}}}{{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>; + fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>; {{/vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}} fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>; @@ -59,7 +59,7 @@ impl {{{classname}}} for {{{classname}}}Client { {{#operations}} {{#operation}} {{#vendorExtensions.x-group-parameters}} - fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{classname}}}{{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> { + fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> { // unbox the parameters {{#allParams}} let {{paramName}} = params.{{paramName}}; diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache index 540d12bf2c8c..bb0103d52da7 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache @@ -41,7 +41,7 @@ pub use self::{{{classFilename}}}::{ {{{classname}}}, {{{classname}}}Client }; {{#vendorExtensions.x-group-parameters}} {{#allParams}} {{#-first}} -pub use self::{{{classFilename}}}::{ {{{classname}}}{{{operationIdCamelCase}}}Params }; +pub use self::{{{classFilename}}}::{{{operationIdCamelCase}}} as {{{classname}}}{{{operationIdCamelCase}}}; {{/-first}} {{/allParams}} {{/vendorExtensions.x-group-parameters}}