mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Issue #3138
Continuation from original PR to update the pet store server auto gen sample code based on previous commit.
This commit is contained in:
parent
0980261709
commit
cb47bec293
@ -28,7 +28,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPost]
|
||||
[Route("/pet")]
|
||||
[SwaggerOperation("AddPet")]
|
||||
public void AddPet([FromBody]Pet body)
|
||||
public virtual void AddPet([FromBody]Pet body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -44,7 +44,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpDelete]
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("DeletePet")]
|
||||
public void DeletePet([FromRoute]long? petId, [FromHeader]string apiKey)
|
||||
public virtual void DeletePet([FromRoute]long? petId, [FromHeader]string apiKey)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -53,7 +53,7 @@ namespace IO.Swagger.Controllers
|
||||
/// <summary>
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma separated strings</remarks>
|
||||
/// <remarks>Multiple status values can be provided with comma seperated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
@ -61,7 +61,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/pet/findByStatus")]
|
||||
[SwaggerOperation("FindPetsByStatus")]
|
||||
[SwaggerResponse(200, type: typeof(List<Pet>))]
|
||||
public IActionResult FindPetsByStatus([FromQuery]List<string> status)
|
||||
public virtual IActionResult FindPetsByStatus([FromQuery]List<string> status)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -75,7 +75,7 @@ namespace IO.Swagger.Controllers
|
||||
/// <summary>
|
||||
/// Finds Pets by tags
|
||||
/// </summary>
|
||||
/// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks>
|
||||
/// <remarks>Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.</remarks>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid tag value</response>
|
||||
@ -83,7 +83,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/pet/findByTags")]
|
||||
[SwaggerOperation("FindPetsByTags")]
|
||||
[SwaggerResponse(200, type: typeof(List<Pet>))]
|
||||
public IActionResult FindPetsByTags([FromQuery]List<string> tags)
|
||||
public virtual IActionResult FindPetsByTags([FromQuery]List<string> tags)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -97,8 +97,8 @@ namespace IO.Swagger.Controllers
|
||||
/// <summary>
|
||||
/// Find pet by ID
|
||||
/// </summary>
|
||||
/// <remarks>Returns a single pet</remarks>
|
||||
/// <param name="petId">ID of pet to return</param>
|
||||
/// <remarks>Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions</remarks>
|
||||
/// <param name="petId">ID of pet that needs to be fetched</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
@ -106,7 +106,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("GetPetById")]
|
||||
[SwaggerResponse(200, type: typeof(Pet))]
|
||||
public IActionResult GetPetById([FromRoute]long? petId)
|
||||
public virtual IActionResult GetPetById([FromRoute]long? petId)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -128,7 +128,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPut]
|
||||
[Route("/pet")]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public void UpdatePet([FromBody]Pet body)
|
||||
public virtual void UpdatePet([FromBody]Pet body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -145,7 +145,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPost]
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("UpdatePetWithForm")]
|
||||
public void UpdatePetWithForm([FromRoute]long? petId, [FromForm]string name, [FromForm]string status)
|
||||
public virtual void UpdatePetWithForm([FromRoute]string petId, [FromForm]string name, [FromForm]string status)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -158,19 +158,13 @@ namespace IO.Swagger.Controllers
|
||||
/// <param name="petId">ID of pet to update</param>
|
||||
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
||||
/// <param name="file">file to upload</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/pet/{petId}/uploadImage")]
|
||||
[SwaggerOperation("UploadFile")]
|
||||
[SwaggerResponse(200, type: typeof(ApiResponse))]
|
||||
public IActionResult UploadFile([FromRoute]long? petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file)
|
||||
public virtual void UploadFile([FromRoute]long? petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<ApiResponse>(exampleJson)
|
||||
: default(ApiResponse);
|
||||
return new ObjectResult(example);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpDelete]
|
||||
[Route("/store/order/{orderId}")]
|
||||
[SwaggerOperation("DeleteOrder")]
|
||||
public void DeleteOrder([FromRoute]string orderId)
|
||||
public virtual void DeleteOrder([FromRoute]string orderId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -44,7 +44,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/store/inventory")]
|
||||
[SwaggerOperation("GetInventory")]
|
||||
[SwaggerResponse(200, type: typeof(Dictionary<string, int?>))]
|
||||
public IActionResult GetInventory()
|
||||
public virtual IActionResult GetInventory()
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -67,7 +67,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/store/order/{orderId}")]
|
||||
[SwaggerOperation("GetOrderById")]
|
||||
[SwaggerResponse(200, type: typeof(Order))]
|
||||
public IActionResult GetOrderById([FromRoute]long? orderId)
|
||||
public virtual IActionResult GetOrderById([FromRoute]string orderId)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -89,7 +89,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/store/order")]
|
||||
[SwaggerOperation("PlaceOrder")]
|
||||
[SwaggerResponse(200, type: typeof(Order))]
|
||||
public IActionResult PlaceOrder([FromBody]Order body)
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPost]
|
||||
[Route("/user")]
|
||||
[SwaggerOperation("CreateUser")]
|
||||
public void CreateUser([FromBody]User body)
|
||||
public virtual void CreateUser([FromBody]User body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -43,7 +43,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPost]
|
||||
[Route("/user/createWithArray")]
|
||||
[SwaggerOperation("CreateUsersWithArrayInput")]
|
||||
public void CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||
public virtual void CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -58,7 +58,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPost]
|
||||
[Route("/user/createWithList")]
|
||||
[SwaggerOperation("CreateUsersWithListInput")]
|
||||
public void CreateUsersWithListInput([FromBody]List<User> body)
|
||||
public virtual void CreateUsersWithListInput([FromBody]List<User> body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -74,7 +74,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpDelete]
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public void DeleteUser([FromRoute]string username)
|
||||
public virtual void DeleteUser([FromRoute]string username)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -92,7 +92,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("GetUserByName")]
|
||||
[SwaggerResponse(200, type: typeof(User))]
|
||||
public IActionResult GetUserByName([FromRoute]string username)
|
||||
public virtual IActionResult GetUserByName([FromRoute]string username)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -115,7 +115,7 @@ namespace IO.Swagger.Controllers
|
||||
[Route("/user/login")]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(200, type: typeof(string))]
|
||||
public IActionResult LoginUser([FromQuery]string username, [FromQuery]string password)
|
||||
public virtual IActionResult LoginUser([FromQuery]string username, [FromQuery]string password)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
@ -134,7 +134,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpGet]
|
||||
[Route("/user/logout")]
|
||||
[SwaggerOperation("LogoutUser")]
|
||||
public void LogoutUser()
|
||||
public virtual void LogoutUser()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace IO.Swagger.Controllers
|
||||
[HttpPut]
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("UpdateUser")]
|
||||
public void UpdateUser([FromRoute]string username, [FromBody]User body)
|
||||
public virtual void UpdateUser([FromRoute]string username, [FromBody]User body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace IO.Swagger.Models
|
||||
/// <param name="Quantity">Quantity.</param>
|
||||
/// <param name="ShipDate">ShipDate.</param>
|
||||
/// <param name="Status">Order Status.</param>
|
||||
/// <param name="Complete">Complete (default to false).</param>
|
||||
/// <param name="Complete">Complete.</param>
|
||||
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, string Status = null, bool? Complete = null)
|
||||
{
|
||||
this.Id = Id;
|
||||
@ -31,15 +31,7 @@ namespace IO.Swagger.Models
|
||||
this.Quantity = Quantity;
|
||||
this.ShipDate = ShipDate;
|
||||
this.Status = Status;
|
||||
// use default value if no "Complete" provided
|
||||
if (Complete == null)
|
||||
{
|
||||
this.Complete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Complete = Complete;
|
||||
}
|
||||
this.Complete = Complete;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user