Skip to content

Commit

Permalink
Update paramName template usage to ensure reserved keywords in parame…
Browse files Browse the repository at this point in the history
…ters name are properly escaped

This commit addresses Yelp#147
  • Loading branch information
macisamuele committed Jan 16, 2021
1 parent 8b24632 commit 9af6c5a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface {{classname}} {
/**{{#summary}}{{{newline}}} * {{{summary}}}{{/summary}}{{#notes}}{{{newline}}} * {{{<br/>}}}{{{notes}}}{{/notes}}
* The endpoint is owned by {{{vendorExtensions.x-team-owners}}}{{^vendorExtensions.x-team-owners}}{{service_name}} service owner{{/vendorExtensions.x-team-owners}}
{{#allParams}}
* @param {{paramName}}{{#description}} {{description}}{{/description}} ({{#required}}required{{/required}}{{^required}}optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}{{/required}})
* @param {{{paramName}}}{{#description}} {{description}}{{/description}} ({{#required}}required{{/required}}{{^required}}optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}{{/required}})
{{/allParams}}
{{#externalDocs}}
* {{description}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isBodyParam}}@retrofit2.http.Body {{paramName}}: {{{dataType}}}{{/isBodyParam}}
{{#isBodyParam}}@retrofit2.http.Body {{{paramName}}}: {{{dataType}}}{{/isBodyParam}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isFormParam}}{{#notFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{paramName}}: {{{dataType}}}{{/notFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}\"; filename=\"{{baseName}}") {{paramName}}: RequestBody{{^required}}?{{/required}}{{/isFile}}{{/isFormParam}}
{{#isFormParam}}{{#notFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{{paramName}}}: {{{dataType}}}{{/notFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}\"; filename=\"{{baseName}}") {{paramName}}: RequestBody{{^required}}?{{/required}}{{/isFile}}{{/isFormParam}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isHeaderParam}}@retrofit2.http.Header("{{baseName}}") {{paramName}}: {{{dataType}}}{{/isHeaderParam}}
{{#isHeaderParam}}@retrofit2.http.Header("{{baseName}}") {{{paramName}}}: {{{dataType}}}{{/isHeaderParam}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isPathParam}}@retrofit2.http.Path("{{baseName}}") {{paramName}}: {{{dataType}}}{{/isPathParam}}
{{#isPathParam}}@retrofit2.http.Path("{{baseName}}") {{{paramName}}}: {{{dataType}}}{{/isPathParam}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isQueryParam}}@retrofit2.http.Query("{{baseName}}") {{#collectionFormat}}{{^isCollectionFormatMulti}}@{{{collectionFormat.toUpperCase}}} {{/isCollectionFormatMulti}}{{/collectionFormat}}{{paramName}}: {{{dataType}}}{{^required}} = null{{/required}}{{/isQueryParam}}
{{#isQueryParam}}@retrofit2.http.Query("{{baseName}}") {{#collectionFormat}}{{^isCollectionFormatMulti}}@{{{collectionFormat.toUpperCase}}} {{/isCollectionFormatMulti}}{{/collectionFormat}}{{{paramName}}}: {{{dataType}}}{{^required}} = null{{/required}}{{/isQueryParam}}

0 comments on commit 9af6c5a

Please sign in to comment.