forked from loafle/openapi-generator-original
Updated SwaggerResponse Attributes so they use the actual dataType instead of the common returnType (#7096)
* Moved SwaggerResponse Attributes to use the respective dataType instead of the common returnType. * Updated examples
This commit is contained in:
parent
4dbb44b061
commit
1541d96b18
@ -32,8 +32,8 @@ namespace {{packageName}}.Controllers
|
||||
[{{httpMethod}}]
|
||||
[Route("{{{basePathWithoutHost}}}{{{path}}}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("{{operationId}}")]{{#responses}}{{#returnType}}
|
||||
[SwaggerResponse({{code}}, typeof({{&returnType}}), "{{message}}")]{{/returnType}}{{/responses}}
|
||||
[SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}}
|
||||
[SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}
|
||||
public virtual IActionResult {{operationId}}({{#allParams}}{{>pathParam}}{{>queryParam}}{{>bodyParam}}{{>formParam}}{{>headerParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
{ {{#responses}}
|
||||
{{#dataType}}
|
||||
|
@ -81,8 +81,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/pet/findByStatus")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FindPetsByStatus")]
|
||||
[SwaggerResponse(200, typeof(List<Pet>), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(List<Pet>), "Invalid status value")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
||||
public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string> status)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -113,8 +112,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/pet/findByTags")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FindPetsByTags")]
|
||||
[SwaggerResponse(200, typeof(List<Pet>), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(List<Pet>), "Invalid tag value")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
||||
public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string> tags)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -146,9 +144,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/pet/{petId}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetPetById")]
|
||||
[SwaggerResponse(200, typeof(Pet), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(Pet), "Invalid ID supplied")]
|
||||
[SwaggerResponse(404, typeof(Pet), "Pet not found")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult GetPetById([FromRoute][Required]long? petId)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -231,7 +227,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/pet/{petId}/uploadImage")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UploadFile")]
|
||||
[SwaggerResponse(200, typeof(ApiResponse), "successful operation")]
|
||||
[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)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
@ -63,7 +63,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/store/inventory")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetInventory")]
|
||||
[SwaggerResponse(200, typeof(Dictionary<string, int?>), "successful operation")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int?>), description: "successful operation")]
|
||||
public virtual IActionResult GetInventory()
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -91,9 +91,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/store/order/{orderId}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetOrderById")]
|
||||
[SwaggerResponse(200, typeof(Order), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(Order), "Invalid ID supplied")]
|
||||
[SwaggerResponse(404, typeof(Order), "Order not found")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult GetOrderById([FromRoute][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(..), ...
|
||||
@ -127,8 +125,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/store/order")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("PlaceOrder")]
|
||||
[SwaggerResponse(200, typeof(Order), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(Order), "Invalid Order")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
@ -123,9 +123,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/user/{username}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetUserByName")]
|
||||
[SwaggerResponse(200, typeof(User), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(User), "Invalid username supplied")]
|
||||
[SwaggerResponse(404, typeof(User), "User not found")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")]
|
||||
public virtual IActionResult GetUserByName([FromRoute][Required]string username)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -160,8 +158,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/v2/user/login")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(200, typeof(string), "successful operation")]
|
||||
[SwaggerResponse(400, typeof(string), "Invalid username/password supplied")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
||||
public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password)
|
||||
{
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
Loading…
x
Reference in New Issue
Block a user