forked from loafle/openapi-generator-original
better struct alias in rust (#6470)
This commit is contained in:
parent
52fcdd5974
commit
7cef7b7591
@ -29,7 +29,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}}
|
||||
/// {{{.}}}
|
||||
@ -49,7 +49,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>;
|
||||
@ -63,7 +63,7 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
{{#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> {
|
||||
{{#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> {
|
||||
// unbox the parameters
|
||||
{{#allParams}}
|
||||
let {{paramName}} = params.{{paramName}};
|
||||
|
@ -46,7 +46,7 @@ pub use self::{{{classFilename}}}::{ {{{operationId}}} };
|
||||
{{#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}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user