Skip to content

Commit 35b94df

Browse files
wing328ffabss
andauthored
[csharp] fix "Simplify 'default' expression (IDE0034)" messages (#21147)
* [csharp] reduce IDE0034 messages in generated code * [csharp] regenerate all samples --------- Co-authored-by: Fabian Buchenberger <[email protected]>
1 parent 6ee94d6 commit 35b94df

File tree

1,046 files changed

+4405
-4405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,046 files changed

+4405
-4405
lines changed

modules/openapi-generator/src/main/resources/aspnetcore/2.0/controller.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace {{packageName}}.Controllers
4040
{ {{#responses}}
4141
{{#dataType}}
4242
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
43-
// return StatusCode({{code}}, default({{&dataType}}));
43+
// return StatusCode({{code}}, default);
4444
{{/dataType}}
4545
{{^dataType}}
4646
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
var example = exampleJson != null
33
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
4-
: default({{{returnType}}});
4+
: default;

modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace {{apiPackage}}
6363
{{#responses}}
6464
{{#dataType}}
6565
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
66-
// return StatusCode({{code}}, default({{&dataType}}));
66+
// return StatusCode({{code}}, default);
6767
{{/dataType}}
6868
{{^dataType}}
6969
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
var example = exampleJson != null
33
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
4-
: default({{{returnType}}});
4+
: default;

modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace {{apiPackage}}
7070
{{#responses}}
7171
{{#dataType}}
7272
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
73-
// return StatusCode({{code}}, default({{&dataType}}));
73+
// return StatusCode({{code}}, default);
7474
{{/dataType}}
7575
{{^dataType}}
7676
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
var example = exampleJson != null
33
? {{#useNewtonsoft}}JsonConvert.DeserializeObject{{/useNewtonsoft}}{{^useNewtonsoft}}JsonSerializer.Deserialize{{/useNewtonsoft}}<{{{returnType}}}>(exampleJson)
4-
: default({{{returnType}}});
4+
: default;

modules/openapi-generator/src/main/resources/csharp-functions/ApiClient.mustache

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ namespace {{packageName}}.Client
537537
}
538538
539539
{{#supportsAsync}}
540-
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
540+
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default)
541541
{
542542
RestClient client = new RestClient(_baseUrl);
543543
@@ -663,7 +663,7 @@ namespace {{packageName}}.Client
663663
/// GlobalConfiguration has been done before calling this method.</param>
664664
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
665665
/// <returns>A Task containing ApiResponse</returns>
666-
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
666+
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
667667
{
668668
var config = configuration ?? GlobalConfiguration.Instance;
669669
return ExecAsync<T>(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken);
@@ -678,7 +678,7 @@ namespace {{packageName}}.Client
678678
/// GlobalConfiguration has been done before calling this method.</param>
679679
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
680680
/// <returns>A Task containing ApiResponse</returns>
681-
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
681+
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
682682
{
683683
var config = configuration ?? GlobalConfiguration.Instance;
684684
return ExecAsync<T>(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken);
@@ -693,7 +693,7 @@ namespace {{packageName}}.Client
693693
/// GlobalConfiguration has been done before calling this method.</param>
694694
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
695695
/// <returns>A Task containing ApiResponse</returns>
696-
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
696+
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
697697
{
698698
var config = configuration ?? GlobalConfiguration.Instance;
699699
return ExecAsync<T>(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken);
@@ -708,7 +708,7 @@ namespace {{packageName}}.Client
708708
/// GlobalConfiguration has been done before calling this method.</param>
709709
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
710710
/// <returns>A Task containing ApiResponse</returns>
711-
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
711+
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
712712
{
713713
var config = configuration ?? GlobalConfiguration.Instance;
714714
return ExecAsync<T>(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken);
@@ -723,7 +723,7 @@ namespace {{packageName}}.Client
723723
/// GlobalConfiguration has been done before calling this method.</param>
724724
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
725725
/// <returns>A Task containing ApiResponse</returns>
726-
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
726+
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
727727
{
728728
var config = configuration ?? GlobalConfiguration.Instance;
729729
return ExecAsync<T>(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken);
@@ -738,7 +738,7 @@ namespace {{packageName}}.Client
738738
/// GlobalConfiguration has been done before calling this method.</param>
739739
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
740740
/// <returns>A Task containing ApiResponse</returns>
741-
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
741+
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
742742
{
743743
var config = configuration ?? GlobalConfiguration.Instance;
744744
return ExecAsync<T>(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken);
@@ -753,7 +753,7 @@ namespace {{packageName}}.Client
753753
/// GlobalConfiguration has been done before calling this method.</param>
754754
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
755755
/// <returns>A Task containing ApiResponse</returns>
756-
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
756+
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default)
757757
{
758758
var config = configuration ?? GlobalConfiguration.Instance;
759759
return ExecAsync<T>(NewRequest(HttpMethod.Patch, path, options, config), config, cancellationToken);

modules/openapi-generator/src/main/resources/csharp-functions/IAsynchronousClient.mustache

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace {{packageName}}.Client
2121
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
2222
/// <typeparam name="T">The return type.</typeparam>
2323
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
24-
Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
24+
Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
2525
2626
/// <summary>
2727
/// Executes a non-blocking call to some <paramref name="path"/> using the POST http verb.
@@ -32,7 +32,7 @@ namespace {{packageName}}.Client
3232
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
3333
/// <typeparam name="T">The return type.</typeparam>
3434
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
35-
Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
35+
Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
3636
3737
/// <summary>
3838
/// Executes a non-blocking call to some <paramref name="path"/> using the PUT http verb.
@@ -43,7 +43,7 @@ namespace {{packageName}}.Client
4343
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
4444
/// <typeparam name="T">The return type.</typeparam>
4545
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
46-
Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
46+
Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
4747
4848
/// <summary>
4949
/// Executes a non-blocking call to some <paramref name="path"/> using the DELETE http verb.
@@ -54,7 +54,7 @@ namespace {{packageName}}.Client
5454
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
5555
/// <typeparam name="T">The return type.</typeparam>
5656
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
57-
Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
57+
Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
5858
5959
/// <summary>
6060
/// Executes a non-blocking call to some <paramref name="path"/> using the HEAD http verb.
@@ -65,7 +65,7 @@ namespace {{packageName}}.Client
6565
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
6666
/// <typeparam name="T">The return type.</typeparam>
6767
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
68-
Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
68+
Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
6969
7070
/// <summary>
7171
/// Executes a non-blocking call to some <paramref name="path"/> using the OPTIONS http verb.
@@ -76,7 +76,7 @@ namespace {{packageName}}.Client
7676
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
7777
/// <typeparam name="T">The return type.</typeparam>
7878
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
79-
Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
79+
Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
8080
8181
/// <summary>
8282
/// Executes a non-blocking call to some <paramref name="path"/> using the PATCH http verb.
@@ -87,6 +87,6 @@ namespace {{packageName}}.Client
8787
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
8888
/// <typeparam name="T">The return type.</typeparam>
8989
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
90-
Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
90+
Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default);
9191
}
9292
}

0 commit comments

Comments
 (0)