Skip to content

Commit 2df7ce5

Browse files
authored
rename local variables (#4297)
1 parent 4ac2738 commit 2df7ce5

File tree

13 files changed

+2178
-2253
lines changed

13 files changed

+2178
-2253
lines changed

modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -234,60 +234,60 @@ namespace {{packageName}}.{{apiPackage}}
234234
{{/required}}
235235
{{/isNullable}}
236236
{{/allParams}}
237-
{{packageName}}.Client.RequestOptions requestOptions = new {{packageName}}.Client.RequestOptions();
237+
{{packageName}}.Client.RequestOptions localVarRequestOptions = new {{packageName}}.Client.RequestOptions();
238238

239-
String[] @contentTypes = new String[] {
239+
String[] _contentTypes = new String[] {
240240
{{#consumes}}
241241
"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}
242242
{{/consumes}}
243243
};
244244

245245
// to determine the Accept header
246-
String[] @accepts = new String[] {
246+
String[] _accepts = new String[] {
247247
{{#produces}}
248248
"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}
249249
{{/produces}}
250250
};
251251

252-
var localVarContentType = {{packageName}}.Client.ClientUtils.SelectHeaderContentType(@contentTypes);
253-
if (localVarContentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
252+
var localVarContentType = {{packageName}}.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
253+
if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
254254

255-
var localVarAccept = {{packageName}}.Client.ClientUtils.SelectHeaderAccept(@accepts);
256-
if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept);
255+
var localVarAccept = {{packageName}}.Client.ClientUtils.SelectHeaderAccept(_accepts);
256+
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
257257

258258
{{#pathParams}}
259259
if ({{paramName}} != null)
260-
requestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
260+
localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
261261
{{/pathParams}}
262262
{{#queryParams}}
263263
if ({{paramName}} != null)
264264
{
265-
foreach (var kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}))
265+
foreach (var _kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}))
266266
{
267-
foreach (var kvpValue in kvp.Value)
267+
foreach (var _kvpValue in _kvp.Value)
268268
{
269-
requestOptions.QueryParameters.Add(kvp.Key, kvpValue);
269+
localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
270270
}
271271
}
272272
}
273273
{{/queryParams}}
274274
{{#headerParams}}
275275
if ({{paramName}} != null)
276-
requestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
276+
localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
277277
{{/headerParams}}
278278
{{#formParams}}
279279
if ({{paramName}} != null)
280280
{
281281
{{#isFile}}
282-
requestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
282+
localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
283283
{{/isFile}}
284284
{{^isFile}}
285-
requestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
285+
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
286286
{{/isFile}}
287287
}
288288
{{/formParams}}
289289
{{#bodyParam}}
290-
requestOptions.Data = {{paramName}};
290+
localVarRequestOptions.Data = {{paramName}};
291291
{{/bodyParam}}
292292

293293
{{#authMethods}}
@@ -296,17 +296,17 @@ namespace {{packageName}}.{{apiPackage}}
296296
{{#isKeyInHeader}}
297297
if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
298298
{
299-
requestOptions.HeaderParameters.Add("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"));
299+
localVarRequestOptions.HeaderParameters.Add("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"));
300300
}
301301
{{/isKeyInHeader}}
302302
{{#isKeyInQuery}}
303303
if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
304304
{
305-
foreach (var kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("", "{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
305+
foreach (var _kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("", "{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
306306
{
307-
foreach (var kvpValue in kvp.Value)
307+
foreach (var _kvpValue in _kvp.Value)
308308
{
309-
requestOptions.QueryParameters.Add(kvp.Key, kvpValue);
309+
localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
310310
}
311311
}
312312
}
@@ -316,29 +316,28 @@ namespace {{packageName}}.{{apiPackage}}
316316
// http basic authentication required
317317
if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
318318
{
319-
requestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
319+
localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
320320
}
321321
{{/isBasic}}
322322
{{#isOAuth}}
323323
// oauth required
324324
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
325325
{
326-
requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
326+
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
327327
}
328328
{{/isOAuth}}
329329
{{/authMethods}}
330330

331331
// make the HTTP request
332-
333-
var response = this.Client.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}<{{#returnType}} {{{returnType}}} {{/returnType}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", requestOptions, this.Configuration);
332+
var localVarResponse = this.Client.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}<{{#returnType}} {{{returnType}}} {{/returnType}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration);
334333

335334
if (this.ExceptionFactory != null)
336335
{
337-
Exception exception = this.ExceptionFactory("{{operationId}}", response);
338-
if (exception != null) throw exception;
336+
Exception _exception = this.ExceptionFactory("{{operationId}}", localVarResponse);
337+
if (_exception != null) throw _exception;
339338
}
340339

341-
return response;
340+
return localVarResponse;
342341
}
343342

344343
{{#supportsAsync}}
@@ -374,60 +373,60 @@ namespace {{packageName}}.{{apiPackage}}
374373
{{/isNullable}}
375374
{{/allParams}}
376375

377-
{{packageName}}.Client.RequestOptions requestOptions = new {{packageName}}.Client.RequestOptions();
376+
{{packageName}}.Client.RequestOptions localVarRequestOptions = new {{packageName}}.Client.RequestOptions();
378377

379-
String[] @contentTypes = new String[] {
378+
String[] _contentTypes = new String[] {
380379
{{#consumes}}
381380
"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}
382381
{{/consumes}}
383382
};
384383

385384
// to determine the Accept header
386-
String[] @accepts = new String[] {
385+
String[] _accepts = new String[] {
387386
{{#produces}}
388387
"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}
389388
{{/produces}}
390389
};
391390

392-
foreach (var contentType in @contentTypes)
393-
requestOptions.HeaderParameters.Add("Content-Type", contentType);
391+
foreach (var _contentType in _contentTypes)
392+
localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
394393

395-
foreach (var accept in @accepts)
396-
requestOptions.HeaderParameters.Add("Accept", accept);
394+
foreach (var _accept in _accepts)
395+
localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
397396

398397
{{#pathParams}}
399398
if ({{paramName}} != null)
400-
requestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
399+
localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
401400
{{/pathParams}}
402401
{{#queryParams}}
403402
if ({{paramName}} != null)
404403
{
405-
foreach (var kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}))
404+
foreach (var _kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}))
406405
{
407-
foreach (var kvpValue in kvp.Value)
406+
foreach (var _kvpValue in _kvp.Value)
408407
{
409-
requestOptions.QueryParameters.Add(kvp.Key, kvpValue);
408+
localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
410409
}
411410
}
412411
}
413412
{{/queryParams}}
414413
{{#headerParams}}
415414
if ({{paramName}} != null)
416-
requestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
415+
localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
417416
{{/headerParams}}
418417
{{#formParams}}
419418
if ({{paramName}} != null)
420419
{
421420
{{#isFile}}
422-
requestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
421+
localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
423422
{{/isFile}}
424423
{{^isFile}}
425-
requestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
424+
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
426425
{{/isFile}}
427426
}
428427
{{/formParams}}
429428
{{#bodyParam}}
430-
requestOptions.Data = {{paramName}};
429+
localVarRequestOptions.Data = {{paramName}};
431430
{{/bodyParam}}
432431

433432
{{#authMethods}}
@@ -436,17 +435,17 @@ namespace {{packageName}}.{{apiPackage}}
436435
{{#isKeyInHeader}}
437436
if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
438437
{
439-
requestOptions.HeaderParameters.Add("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"));
438+
localVarRequestOptions.HeaderParameters.Add("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"));
440439
}
441440
{{/isKeyInHeader}}
442441
{{#isKeyInQuery}}
443442
if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
444443
{
445-
foreach (var kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("", "{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
444+
foreach (var _kvp in {{packageName}}.Client.ClientUtils.ParameterToMultiMap("", "{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
446445
{
447-
foreach (var kvpValue in kvp.Value)
446+
foreach (var _kvpValue in _kvp.Value)
448447
{
449-
requestOptions.QueryParameters.Add(kvp.Key, kvpValue);
448+
localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
450449
}
451450
}
452451
}
@@ -456,29 +455,29 @@ namespace {{packageName}}.{{apiPackage}}
456455
// http basic authentication required
457456
if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
458457
{
459-
requestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
458+
localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
460459
}
461460
{{/isBasic}}
462461
{{#isOAuth}}
463462
// oauth required
464463
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
465464
{
466-
requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
465+
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
467466
}
468467
{{/isOAuth}}
469468
{{/authMethods}}
470469

471470
// make the HTTP request
472471

473-
var response = await this.AsynchronousClient.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Async<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", requestOptions, this.Configuration);
472+
var localVarResponse = await this.AsynchronousClient.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Async<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration);
474473

475474
if (this.ExceptionFactory != null)
476475
{
477-
Exception exception = this.ExceptionFactory("{{operationId}}", response);
478-
if (exception != null) throw exception;
476+
Exception _exception = this.ExceptionFactory("{{operationId}}", localVarResponse);
477+
if (_exception != null) throw _exception;
479478
}
480479

481-
return response;
480+
return localVarResponse;
482481
}
483482

484483
{{/supportsAsync}}

0 commit comments

Comments
 (0)