You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've had a lot of trouble with params moving around as the underlying YML are updated. Here we used named parameter objects to stabilize the params args being passed and make existing code calling us more stable and less prone to drift errors.
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -300,6 +300,7 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
300
300
301
301
// Add the more complicated component instead of just the brace.
{{/allParams}}* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
59
+
* @param {{nickname}}Params
60
+
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
55
61
* @param reportProgress flag to report request and response progress.
56
62
*/
57
-
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
58
-
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable<any> {
63
+
public {{nickname}}(params: {{nickname}}Params): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
64
+
public {{nickname}}(params: {{nickname}}Params): Observable<any> {
59
65
{{#allParams}}
60
66
61
67
{{#required}}
62
68
{{#isConstEnumParam}}
63
69
let {{paramName}} = {{{dataType}}};
64
70
{{/isConstEnumParam}}
65
71
{{^isConstEnumParam}}
66
-
if ({{paramName}} === null || {{paramName}} === undefined) {
67
-
throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
72
+
if ( params.{{paramName}} === null || params.{{paramName}} === undefined) {
73
+
throw new Error('Required parameter params.{{paramName}} was null or undefined when calling {{nickname}}.');
if ({{paramName}} !== undefined && {{paramName}} !== null) {
95
+
if (params.{{paramName}} !== undefined && params.{{paramName}} !== null) {
90
96
{{#isDateTime}}
91
-
queryParameters['{{baseName}}'] = (<any>{{paramName}} as any instanceof Date) ? ({{paramName}} as any).toISOString(): {{paramName}};
97
+
queryParameters['{{baseName}}'] = (<any>params.{{paramName}} as any instanceof Date) ? (params.{{paramName}} as any).toISOString(): params.{{paramName}};
0 commit comments