Skip to content

Commit

Permalink
Fix api.mustache template to work with header parameters (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopalet authored Sep 25, 2023
1 parent 3cbcf3b commit 2c00dca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions templates/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/stru
apiService *{{classname}}Service
{{/generateInterfaces}}
{{#allParams}}
{{paramName}} {{#isPathParam}}{{{dataType}}}{{/isPathParam}}{{#isQueryParam}}*{{{dataType}}}{{/isQueryParam}}{{^isQueryParam}}{{^isPathParam}}{{^isFile}}*{{{operationId}}}Payload{{/isFile}}{{/isPathParam}}{{/isQueryParam}}
{{paramName}} {{^isPathParam}}{{^isFile}}*{{/isFile}}{{/isPathParam}}{{{dataType}}}
{{/allParams}}
}

Expand All @@ -69,8 +69,7 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/stru
// Deprecated
{{/isDeprecated}}

// func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request {
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request) {{#isQueryParam}}{{vendorExtensions.x-export-param-name}}{{/isQueryParam}}{{^isQueryParam}}{{^isPathParam}}{{^isFile}}{{{operationId}}}Payload{{/isFile}}{{/isPathParam}}{{/isQueryParam}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request {
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request {
r.{{paramName}} = {{^isFile}}&{{/isFile}}{{paramName}}
return r
}
Expand Down

0 comments on commit 2c00dca

Please sign in to comment.