From 59079239073724046f60bfd097a7994ce8fe3e8a Mon Sep 17 00:00:00 2001 From: Felix Winterhalter Date: Wed, 24 Feb 2021 19:00:51 +0100 Subject: [PATCH 1/4] Fix parameter Name= missing. --- .../src/main/resources/aspnetcore/2.0/formParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.0/pathParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.0/queryParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.1/formParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.1/pathParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.1/queryParam.mustache | 2 +- .../src/main/resources/aspnetcore/3.0/formParam.mustache | 2 +- .../src/main/resources/aspnetcore/3.0/pathParam.mustache | 2 +- .../src/main/resources/aspnetcore/3.0/queryParam.mustache | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache index 2d42dc2916ba..d38cada7bc0c 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache @@ -1 +1 @@ -{{#isFormParam}}[FromForm]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}[FromForm (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/pathParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/pathParam.mustache index 70303432d48d..e2a30150536f 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/pathParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/pathParam.mustache @@ -1 +1 @@ -{{#isPathParam}}[FromRoute]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}[FromRoute (Name = "{{baseName}}")]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache index e9fa09b005d3..1675d2e236f5 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache @@ -1 +1 @@ -{{#isQueryParam}}[FromQuery]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}[FromQuery (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache index fbd2d815d58d..eb6ddb13bcd0 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache @@ -1 +1 @@ -{{#isFormParam}}[FromForm]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}[FromForm (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache index 7a7ffd3ab16a..3447b8005d13 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache @@ -1 +1 @@ -{{#isPathParam}}[FromRoute]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}[FromRoute (Name = "{{baseName}}")]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache index c454950bd147..823f90ae96d5 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache @@ -1 +1 @@ -{{#isQueryParam}}[FromQuery]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}[FromQuery (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache index fbd2d815d58d..e71c9619d854 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache @@ -1 +1 @@ -{{#isFormParam}}[FromForm]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}[FromForm (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache index 7a7ffd3ab16a..3447b8005d13 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache @@ -1 +1 @@ -{{#isPathParam}}[FromRoute]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}[FromRoute (Name = "{{baseName}}")]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache index c454950bd147..823f90ae96d5 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache @@ -1 +1 @@ -{{#isQueryParam}}[FromQuery]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}[FromQuery (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file From b13a490af593df2f7e6273a55193908947fc90d6 Mon Sep 17 00:00:00 2001 From: Felix Winterhalter Date: Wed, 24 Feb 2021 19:00:57 +0100 Subject: [PATCH 2/4] Update samples --- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 12 ++++++------ .../src/Org.OpenAPITools/Controllers/StoreApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 8 ++++---- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 12 ++++++------ .../src/Org.OpenAPITools/Controllers/StoreApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 8 ++++---- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 12 ++++++------ .../src/Org.OpenAPITools/Controllers/StoreApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 8 ++++---- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 12 ++++++------ .../src/Org.OpenAPITools/Controllers/StoreApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 8 ++++---- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs index 2102b82d8fe6..f549ae4dd0bb 100644 --- a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -55,7 +55,7 @@ public virtual IActionResult AddPet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("DeletePet")] - public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader]string apiKey) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -76,7 +76,7 @@ public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHea [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -106,7 +106,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -138,7 +138,7 @@ public virtual IActionResult FindPetsByTags([FromQuery][Required()]List [ValidateModelState] [SwaggerOperation("GetPetById")] [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] - public virtual IActionResult GetPetById([FromRoute][Required]long petId) + public virtual IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult UpdatePet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("UpdatePetWithForm")] - public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status) { //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -214,7 +214,7 @@ public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [ValidateModelState] [SwaggerOperation("UploadFile")] [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] - public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, [FromForm (Name = "file")]System.IO.Stream file) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs index fa909a61a146..8d3101706af8 100644 --- a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -38,7 +38,7 @@ public class StoreApiController : ControllerBase [Route("/v2/store/order/{orderId}")] [ValidateModelState] [SwaggerOperation("DeleteOrder")] - public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + public virtual IActionResult DeleteOrder([FromRoute (Name = "orderId")][Required]string orderId) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -87,7 +87,7 @@ public virtual IActionResult GetInventory() [ValidateModelState] [SwaggerOperation("GetOrderById")] [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] - public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + public virtual IActionResult GetOrderById([FromRoute (Name = "orderId")][Required][Range(1, 5)]long orderId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs index c37f0251d3bc..6d46cbacb005 100644 --- a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -93,7 +93,7 @@ public virtual IActionResult CreateUsersWithListInput([FromBody]List body) [Route("/v2/user/{username}")] [ValidateModelState] [SwaggerOperation("DeleteUser")] - public virtual IActionResult DeleteUser([FromRoute][Required]string username) + public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -116,7 +116,7 @@ public virtual IActionResult DeleteUser([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("GetUserByName")] [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] - public virtual IActionResult GetUserByName([FromRoute][Required]string username) + public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -148,7 +148,7 @@ public virtual IActionResult GetUserByName([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()]string username, [FromQuery (Name = "")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult LogoutUser() [Route("/v2/user/{username}")] [ValidateModelState] [SwaggerOperation("UpdateUser")] - public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body) + public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs index 2102b82d8fe6..f549ae4dd0bb 100644 --- a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -55,7 +55,7 @@ public virtual IActionResult AddPet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("DeletePet")] - public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader]string apiKey) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -76,7 +76,7 @@ public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHea [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -106,7 +106,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -138,7 +138,7 @@ public virtual IActionResult FindPetsByTags([FromQuery][Required()]List [ValidateModelState] [SwaggerOperation("GetPetById")] [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] - public virtual IActionResult GetPetById([FromRoute][Required]long petId) + public virtual IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult UpdatePet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("UpdatePetWithForm")] - public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status) { //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -214,7 +214,7 @@ public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [ValidateModelState] [SwaggerOperation("UploadFile")] [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] - public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, [FromForm (Name = "file")]System.IO.Stream file) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs index fa909a61a146..8d3101706af8 100644 --- a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -38,7 +38,7 @@ public class StoreApiController : ControllerBase [Route("/v2/store/order/{orderId}")] [ValidateModelState] [SwaggerOperation("DeleteOrder")] - public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + public virtual IActionResult DeleteOrder([FromRoute (Name = "orderId")][Required]string orderId) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -87,7 +87,7 @@ public virtual IActionResult GetInventory() [ValidateModelState] [SwaggerOperation("GetOrderById")] [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] - public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + public virtual IActionResult GetOrderById([FromRoute (Name = "orderId")][Required][Range(1, 5)]long orderId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs index c37f0251d3bc..6d46cbacb005 100644 --- a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -93,7 +93,7 @@ public virtual IActionResult CreateUsersWithListInput([FromBody]List body) [Route("/v2/user/{username}")] [ValidateModelState] [SwaggerOperation("DeleteUser")] - public virtual IActionResult DeleteUser([FromRoute][Required]string username) + public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -116,7 +116,7 @@ public virtual IActionResult DeleteUser([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("GetUserByName")] [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] - public virtual IActionResult GetUserByName([FromRoute][Required]string username) + public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -148,7 +148,7 @@ public virtual IActionResult GetUserByName([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()]string username, [FromQuery (Name = "")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult LogoutUser() [Route("/v2/user/{username}")] [ValidateModelState] [SwaggerOperation("UpdateUser")] - public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body) + public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs index bf40c6c910fe..155229c205af 100644 --- a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -66,7 +66,7 @@ public virtual IActionResult AddPet([FromBody]Pet pet) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("DeletePet")] - public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader]string apiKey) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -87,7 +87,7 @@ public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHea [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -117,7 +117,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -149,7 +149,7 @@ public virtual IActionResult FindPetsByTags([FromQuery][Required()]List [ValidateModelState] [SwaggerOperation("GetPetById")] [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] - public virtual IActionResult GetPetById([FromRoute][Required]long petId) + public virtual IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -215,7 +215,7 @@ public virtual IActionResult UpdatePet([FromBody]Pet pet) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("UpdatePetWithForm")] - public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status) { //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -236,7 +236,7 @@ public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [ValidateModelState] [SwaggerOperation("UploadFile")] [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] - public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, [FromForm (Name = "file")]System.IO.Stream file) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/StoreApi.cs index b03b0d9ae9f4..c92037c02bb2 100644 --- a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -38,7 +38,7 @@ public class StoreApiController : ControllerBase [Route("/v2/store/order/{orderId}")] [ValidateModelState] [SwaggerOperation("DeleteOrder")] - public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + public virtual IActionResult DeleteOrder([FromRoute (Name = "orderId")][Required]string orderId) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -87,7 +87,7 @@ public virtual IActionResult GetInventory() [ValidateModelState] [SwaggerOperation("GetOrderById")] [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] - public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + public virtual IActionResult GetOrderById([FromRoute (Name = "orderId")][Required][Range(1, 5)]long orderId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs index be1a1ab2e4b2..35b6d0adaf01 100644 --- a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -97,7 +97,7 @@ public virtual IActionResult CreateUsersWithListInput([FromBody]List user) [Authorize(Policy = "api_key")] [ValidateModelState] [SwaggerOperation("DeleteUser")] - public virtual IActionResult DeleteUser([FromRoute][Required]string username) + public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -120,7 +120,7 @@ public virtual IActionResult DeleteUser([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("GetUserByName")] [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] - public virtual IActionResult GetUserByName([FromRoute][Required]string username) + public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -152,7 +152,7 @@ public virtual IActionResult GetUserByName([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery][Required()][RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]string username, [FromQuery][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()][RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]string username, [FromQuery (Name = "")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -199,7 +199,7 @@ public virtual IActionResult LogoutUser() [Authorize(Policy = "api_key")] [ValidateModelState] [SwaggerOperation("UpdateUser")] - public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User user) + public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User user) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs index 4a382880df28..74ad27937c7d 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -55,7 +55,7 @@ public virtual IActionResult AddPet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("DeletePet")] - public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader]string apiKey) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -76,7 +76,7 @@ public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHea [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -106,7 +106,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -138,7 +138,7 @@ public virtual IActionResult FindPetsByTags([FromQuery][Required()]List [ValidateModelState] [SwaggerOperation("GetPetById")] [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] - public virtual IActionResult GetPetById([FromRoute][Required]long petId) + public virtual IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult UpdatePet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("UpdatePetWithForm")] - public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "")]string name, [FromForm (Name = "")]string status) { //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -214,7 +214,7 @@ public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [ValidateModelState] [SwaggerOperation("UploadFile")] [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] - public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "")]string additionalMetadata, [FromForm (Name = "")]System.IO.Stream file) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs index 6fb3586c6788..c552f329fe38 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -38,7 +38,7 @@ public class StoreApiController : ControllerBase [Route("/v2/store/order/{orderId}")] [ValidateModelState] [SwaggerOperation("DeleteOrder")] - public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + public virtual IActionResult DeleteOrder([FromRoute (Name = "orderId")][Required]string orderId) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -87,7 +87,7 @@ public virtual IActionResult GetInventory() [ValidateModelState] [SwaggerOperation("GetOrderById")] [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] - public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + public virtual IActionResult GetOrderById([FromRoute (Name = "orderId")][Required][Range(1, 5)]long orderId) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs index 45ebf16ac795..dfa56effa9b4 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -93,7 +93,7 @@ public virtual IActionResult CreateUsersWithListInput([FromBody]List body) [Route("/v2/user/{username}")] [ValidateModelState] [SwaggerOperation("DeleteUser")] - public virtual IActionResult DeleteUser([FromRoute][Required]string username) + public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -116,7 +116,7 @@ public virtual IActionResult DeleteUser([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("GetUserByName")] [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] - public virtual IActionResult GetUserByName([FromRoute][Required]string username) + public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Required]string username) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -148,7 +148,7 @@ public virtual IActionResult GetUserByName([FromRoute][Required]string username) [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()]string username, [FromQuery (Name = "")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult LogoutUser() [Route("/v2/user/{username}")] [ValidateModelState] [SwaggerOperation("UpdateUser")] - public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body) + public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body) { //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... From 9648b24992466362337b6dc1c2703e9e358ffc93 Mon Sep 17 00:00:00 2001 From: Felix Winterhalter Date: Wed, 24 Feb 2021 19:05:43 +0100 Subject: [PATCH 3/4] Fix wrong name in template --- .../src/main/resources/aspnetcore/2.0/formParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.0/queryParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.1/formParam.mustache | 2 +- .../src/main/resources/aspnetcore/2.1/queryParam.mustache | 2 +- .../src/main/resources/aspnetcore/3.0/queryParam.mustache | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache index d38cada7bc0c..80eb9f630bb9 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache @@ -1 +1 @@ -{{#isFormParam}}[FromForm (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}[FromForm (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache index 1675d2e236f5..cafc0ccf8680 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache @@ -1 +1 @@ -{{#isQueryParam}}[FromQuery (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}[FromQuery (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache index eb6ddb13bcd0..e71c9619d854 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache @@ -1 +1 @@ -{{#isFormParam}}[FromForm (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}[FromForm (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache index 823f90ae96d5..3a052802fcd7 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache @@ -1 +1 @@ -{{#isQueryParam}}[FromQuery (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}[FromQuery (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache index 823f90ae96d5..3a052802fcd7 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache @@ -1 +1 @@ -{{#isQueryParam}}[FromQuery (Name = "{{baseParam}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}[FromQuery (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file From 5794040868c2c3461b55da0e7187ff431540b6c1 Mon Sep 17 00:00:00 2001 From: Felix Winterhalter Date: Wed, 24 Feb 2021 19:07:24 +0100 Subject: [PATCH 4/4] Update samples again --- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 2 +- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 2 +- .../src/Org.OpenAPITools/Controllers/PetApi.cs | 4 ++-- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 2 +- .../aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs | 8 ++++---- .../src/Org.OpenAPITools/Controllers/UserApi.cs | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs index f549ae4dd0bb..12bfa96f1f1f 100644 --- a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -76,7 +76,7 @@ public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]lon [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "status")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -106,7 +106,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required() [ValidateModelState] [SwaggerOperation("FindPetsByTags")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "tags")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs index 6d46cbacb005..330997cd1af6 100644 --- a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -148,7 +148,7 @@ public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Requi [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()]string username, [FromQuery (Name = "")][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs index f549ae4dd0bb..12bfa96f1f1f 100644 --- a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -76,7 +76,7 @@ public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]lon [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "status")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -106,7 +106,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required() [ValidateModelState] [SwaggerOperation("FindPetsByTags")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "tags")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs index 6d46cbacb005..330997cd1af6 100644 --- a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -148,7 +148,7 @@ public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Requi [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()]string username, [FromQuery (Name = "")][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs index 155229c205af..29f2b5560b91 100644 --- a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -87,7 +87,7 @@ public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]lon [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "status")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -117,7 +117,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required() [ValidateModelState] [SwaggerOperation("FindPetsByTags")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "tags")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs index 35b6d0adaf01..2d0fa2261d75 100644 --- a/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore-5.0/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -152,7 +152,7 @@ public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Requi [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()][RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]string username, [FromQuery (Name = "")][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()][RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]string username, [FromQuery (Name = "password")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs index 74ad27937c7d..a36bbafd5a98 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -76,7 +76,7 @@ public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]lon [ValidateModelState] [SwaggerOperation("FindPetsByStatus")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required()]List status) + public virtual IActionResult FindPetsByStatus([FromQuery (Name = "status")][Required()]List status) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -106,7 +106,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery (Name = "")][Required() [ValidateModelState] [SwaggerOperation("FindPetsByTags")] [SwaggerResponse(statusCode: 200, type: typeof(List), description: "successful operation")] - public virtual IActionResult FindPetsByTags([FromQuery (Name = "")][Required()]List tags) + public virtual IActionResult FindPetsByTags([FromQuery (Name = "tags")][Required()]List tags) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -193,7 +193,7 @@ public virtual IActionResult UpdatePet([FromBody]Pet body) [Route("/v2/pet/{petId}")] [ValidateModelState] [SwaggerOperation("UpdatePetWithForm")] - public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "")]string name, [FromForm (Name = "")]string status) + public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status) { //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... @@ -214,7 +214,7 @@ public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Requ [ValidateModelState] [SwaggerOperation("UploadFile")] [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] - public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "")]string additionalMetadata, [FromForm (Name = "")]System.IO.Stream file) + public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, [FromForm (Name = "file")]System.IO.Stream file) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs index dfa56effa9b4..5e2558125ae2 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -148,7 +148,7 @@ public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Requi [ValidateModelState] [SwaggerOperation("LoginUser")] [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] - public virtual IActionResult LoginUser([FromQuery (Name = "")][Required()]string username, [FromQuery (Name = "")][Required()]string password) + public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][Required()]string password) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...