diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache
index ba1d43982a7d..19631a4ee417 100644
--- a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache
+++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
{{#operationResultTask}}
+using System.Threading;
using System.Threading.Tasks;
{{/operationResultTask}}
using Microsoft.AspNetCore.Authorization;
@@ -31,7 +32,8 @@ namespace {{apiPackage}}
/// {{summary}}
/// {{#notes}}
/// {{.}}{{/notes}}{{#allParams}}
- /// {{description}}{{#isDeprecated}} (deprecated){{/isDeprecated}}{{/allParams}}{{#responses}}
+ /// {{description}}{{#isDeprecated}} (deprecated){{/isDeprecated}}{{/allParams}}{{#operationResultTask}}{{#operationIsAsync}}
+ /// The cancellation token to cancel the operation.{{/operationIsAsync}}{{/operationResultTask}}{{#responses}}
/// {{message}}{{/responses}}
[{{httpMethod}}]
[Route("{{{basePathWithoutHost}}}{{{path}}}")]
@@ -53,7 +55,7 @@ namespace {{apiPackage}}
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
- public {{operationModifier}} {{#operationResultTask}}{{#operationIsAsync}}async {{/operationIsAsync}}Task<{{/operationResultTask}}IActionResult{{#operationResultTask}}>{{/operationResultTask}} {{operationId}}({{#allParams}}{{>pathParam}}{{>queryParam}}{{>bodyParam}}{{>formParam}}{{>headerParam}}{{^-last}}{{^isCookieParam}}, {{/isCookieParam}}{{/-last}}{{/allParams}}){{^generateBody}};{{/generateBody}}
+ public {{operationModifier}} {{#operationResultTask}}{{#operationIsAsync}}async {{/operationIsAsync}}Task<{{/operationResultTask}}IActionResult{{#operationResultTask}}>{{/operationResultTask}} {{operationId}}({{#allParams}}{{>pathParam}}{{>queryParam}}{{>bodyParam}}{{>formParam}}{{>headerParam}}{{^-last}}{{^isCookieParam}}, {{/isCookieParam}}{{/-last}}{{#-last}}{{#operationResultTask}}{{#operationIsAsync}}, {{/operationIsAsync}}{{/operationResultTask}}{{/-last}}{{/allParams}}{{#operationResultTask}}{{#operationIsAsync}}CancellationToken cancellationToken{{/operationIsAsync}}{{/operationResultTask}}){{^generateBody}};{{/generateBody}}
{{#generateBody}}
{
{{#cookieParams}}
@@ -78,7 +80,7 @@ namespace {{apiPackage}}
{{#isListCollection}}{{>listReturn}}{{/isListCollection}}{{^isListCollection}}{{#isMap}}{{>mapReturn}}{{/isMap}}{{^isMap}}{{>objectReturn}}{{/isMap}}{{/isListCollection}}
{{!TODO: defaultResponse, examples, auth, consumes, produces, nickname, externalDocs, imports, security}}
//TODO: Change the data returned
- return {{#operationResultTask}}Task.FromResult({{/operationResultTask}}new ObjectResult(example){{#operationResultTask}}){{/operationResultTask}};{{/returnType}}{{^returnType}}
+ return {{#operationResultTask}}{{#operationIsAsync}}await {{/operationIsAsync}}Task.FromResult({{/operationResultTask}}new ObjectResult(example){{#operationResultTask}}){{/operationResultTask}};{{/returnType}}{{^returnType}}
throw new NotImplementedException();{{/returnType}}
}
{{/generateBody}}