Skip to content

Commit 7cef7b7

Browse files
authored
better struct alias in rust (#6470)
1 parent 52fcdd5 commit 7cef7b7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl {{{classname}}}Client {
2929
{{#-first}}
3030
/// struct for passing parameters to the method `{{operationId}}`
3131
#[derive(Clone, Debug)]
32-
pub struct {{{classname}}}{{{operationIdCamelCase}}}Params {
32+
pub struct {{{operationIdCamelCase}}}Params {
3333
{{/-first}}
3434
{{#description}}
3535
/// {{{.}}}
@@ -49,7 +49,7 @@ pub trait {{{classname}}} {
4949
{{#operations}}
5050
{{#operation}}
5151
{{#vendorExtensions.x-group-parameters}}
52-
fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{classname}}}{{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
52+
fn {{{operationId}}}(&self{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
5353
{{/vendorExtensions.x-group-parameters}}
5454
{{^vendorExtensions.x-group-parameters}}
5555
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>;
@@ -63,7 +63,7 @@ impl {{{classname}}} for {{{classname}}}Client {
6363
{{#operations}}
6464
{{#operation}}
6565
{{#vendorExtensions.x-group-parameters}}
66-
{{#supportAsync}}pub async {{/supportAsync}}fn {{{operationId}}}({{^supportAsync}}&self{{/supportAsync}}{{#supportAsync}}configuration: &configuration::Configuration{{/supportAsync}}{{#allParams}}{{#-first}}, params: {{{classname}}}{{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
66+
{{#supportAsync}}pub async {{/supportAsync}}fn {{{operationId}}}({{^supportAsync}}&self{{/supportAsync}}{{#supportAsync}}configuration: &configuration::Configuration{{/supportAsync}}{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
6767
// unbox the parameters
6868
{{#allParams}}
6969
let {{paramName}} = params.{{paramName}};

modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub use self::{{{classFilename}}}::{ {{{operationId}}} };
4646
{{#vendorExtensions.x-group-parameters}}
4747
{{#allParams}}
4848
{{#-first}}
49-
pub use self::{{{classFilename}}}::{ {{{classname}}}{{{operationIdCamelCase}}}Params };
49+
pub use self::{{{classFilename}}}::{{{operationIdCamelCase}}} as {{{classname}}}{{{operationIdCamelCase}}};
5050
{{/-first}}
5151
{{/allParams}}
5252
{{/vendorExtensions.x-group-parameters}}

0 commit comments

Comments
 (0)