mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 02:02:45 +00:00
Fix NPE when generating examples for parameter (object) (#12538)
* fix NPE when generating examples for parameter (object) * add new files
This commit is contained in:
@@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,20 +31,31 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/pet")]
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("AddPet")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +81,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma separated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <param name="status">Status values that need to be considered for filter (deprecated)</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
@@ -164,7 +175,8 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
/// <response code="405">Validation exception</response>
|
||||
@@ -173,17 +185,27 @@ namespace Org.OpenAPITools.Controllers
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(400);
|
||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(404);
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -111,15 +111,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
/// <param name="order">order placed for purchasing the pet</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid Order</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/store/order")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("PlaceOrder")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order order)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
||||
@@ -32,13 +32,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Create user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="body">Created user object</param>
|
||||
/// <param name="user">Created user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUser")]
|
||||
public virtual IActionResult CreateUser([FromBody]User body)
|
||||
public virtual IActionResult CreateUser([FromBody]User user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@@ -50,13 +52,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithArray")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithArrayInput")]
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@@ -68,13 +72,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithList")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithListInput")]
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@@ -92,6 +98,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username)
|
||||
@@ -149,7 +156,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
||||
public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][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(..), ...
|
||||
@@ -171,6 +178,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/logout")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LogoutUser")]
|
||||
public virtual IActionResult LogoutUser()
|
||||
@@ -187,14 +195,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <param name="user">Updated user object</param>
|
||||
/// <response code="400">Invalid user supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpPut]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdateUser")]
|
||||
public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body)
|
||||
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(..), ...
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"openapi" : "3.0.1",
|
||||
"openapi" : "3.0.0",
|
||||
"info" : {
|
||||
"description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
"license" : {
|
||||
@@ -9,6 +9,10 @@
|
||||
"title" : "OpenAPI Petstore",
|
||||
"version" : "1.0.0"
|
||||
},
|
||||
"externalDocs" : {
|
||||
"description" : "Find out more about Swagger",
|
||||
"url" : "http://swagger.io"
|
||||
},
|
||||
"servers" : [ {
|
||||
"url" : "http://petstore.swagger.io/v2"
|
||||
} ],
|
||||
@@ -25,26 +29,28 @@
|
||||
"paths" : {
|
||||
"/pet" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "addPet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@@ -52,38 +58,37 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Add a new pet to the store",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"put" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Validation exception"
|
||||
}
|
||||
},
|
||||
@@ -91,8 +96,7 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Update an existing pet",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
}
|
||||
},
|
||||
"/pet/findByStatus" : {
|
||||
@@ -100,6 +104,7 @@
|
||||
"description" : "Multiple status values can be provided with comma separated strings",
|
||||
"operationId" : "findPetsByStatus",
|
||||
"parameters" : [ {
|
||||
"deprecated" : true,
|
||||
"description" : "Status values that need to be considered for filter",
|
||||
"explode" : false,
|
||||
"in" : "query",
|
||||
@@ -138,12 +143,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid status value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by status",
|
||||
"tags" : [ "pet" ]
|
||||
@@ -191,12 +195,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid tag value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by tags",
|
||||
"tags" : [ "pet" ]
|
||||
@@ -204,26 +207,31 @@
|
||||
},
|
||||
"/pet/{petId}" : {
|
||||
"delete" : {
|
||||
"description" : "",
|
||||
"operationId" : "deletePet",
|
||||
"parameters" : [ {
|
||||
"explode" : false,
|
||||
"in" : "header",
|
||||
"name" : "api_key",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}, {
|
||||
"description" : "Pet id to delete",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid pet value"
|
||||
}
|
||||
},
|
||||
@@ -238,13 +246,15 @@
|
||||
"operationId" : "getPetById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to return",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -263,11 +273,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
}
|
||||
},
|
||||
@@ -278,16 +286,19 @@
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePetWithForm",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be updated",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@@ -300,7 +311,6 @@
|
||||
},
|
||||
"responses" : {
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@@ -313,16 +323,19 @@
|
||||
},
|
||||
"/pet/{petId}/uploadImage" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "uploadFile",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to update",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@@ -381,10 +394,11 @@
|
||||
},
|
||||
"/store/order" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "placeOrder",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Order"
|
||||
}
|
||||
@@ -410,13 +424,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid Order"
|
||||
}
|
||||
},
|
||||
"summary" : "Place an order for a pet",
|
||||
"tags" : [ "store" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "store" ]
|
||||
}
|
||||
},
|
||||
"/store/order/{orderId}" : {
|
||||
@@ -425,20 +437,20 @@
|
||||
"operationId" : "deleteOrder",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of the order that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@@ -450,6 +462,7 @@
|
||||
"operationId" : "getOrderById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be fetched",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
@@ -458,7 +471,8 @@
|
||||
"maximum" : 5,
|
||||
"minimum" : 1,
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -477,11 +491,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@@ -495,7 +507,7 @@
|
||||
"operationId" : "createUser",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@@ -506,90 +518,79 @@
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Create user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithArray" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithArrayInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithList" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithListInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/login" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "loginUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The user name for login",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
}, {
|
||||
"description" : "The password for login in clear text",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "password",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -607,24 +608,36 @@
|
||||
},
|
||||
"description" : "successful operation",
|
||||
"headers" : {
|
||||
"Set-Cookie" : {
|
||||
"description" : "Cookie authentication key for use with the `api_key` apiKey authentication.",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"example" : "AUTH_KEY=abcde12345; Path=/; HttpOnly",
|
||||
"type" : "string"
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Rate-Limit" : {
|
||||
"description" : "calls per hour allowed by the user",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "int32",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Expires-After" : {
|
||||
"description" : "date in UTC when token expires",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username/password supplied"
|
||||
}
|
||||
},
|
||||
@@ -634,13 +647,16 @@
|
||||
},
|
||||
"/user/logout" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "logoutUser",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Logs out current logged in user session",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
@@ -651,36 +667,42 @@
|
||||
"operationId" : "deleteUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Delete user",
|
||||
"tags" : [ "user" ]
|
||||
},
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "getUserByName",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be fetched. Use user1 for testing.",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -699,11 +721,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
@@ -715,16 +735,18 @@
|
||||
"operationId" : "updateUser",
|
||||
"parameters" : [ {
|
||||
"description" : "name that need to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@@ -735,21 +757,76 @@
|
||||
},
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid user supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
"requestBodies" : {
|
||||
"UserArray" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
},
|
||||
"Pet" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
}
|
||||
},
|
||||
"schemas" : {
|
||||
"Order" : {
|
||||
"description" : "An order for a pets from the pet store",
|
||||
@@ -806,6 +883,7 @@
|
||||
"type" : "integer"
|
||||
},
|
||||
"name" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
@@ -935,6 +1013,7 @@
|
||||
}
|
||||
},
|
||||
"status" : {
|
||||
"deprecated" : true,
|
||||
"description" : "pet status in the store",
|
||||
"enum" : [ "available", "pending", "sold" ],
|
||||
"type" : "string"
|
||||
@@ -979,7 +1058,8 @@
|
||||
"description" : "Updated status of the pet",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
},
|
||||
"uploadFile_request" : {
|
||||
"properties" : {
|
||||
@@ -992,7 +1072,8 @@
|
||||
"format" : "binary",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
}
|
||||
},
|
||||
"securitySchemes" : {
|
||||
@@ -1014,6 +1095,5 @@
|
||||
"type" : "apiKey"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-original-swagger-version" : "2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,20 +31,31 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/pet")]
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("AddPet")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +81,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma separated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <param name="status">Status values that need to be considered for filter (deprecated)</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
@@ -164,7 +175,8 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
/// <response code="405">Validation exception</response>
|
||||
@@ -173,17 +185,27 @@ namespace Org.OpenAPITools.Controllers
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(400);
|
||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(404);
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -111,15 +111,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
/// <param name="order">order placed for purchasing the pet</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid Order</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/store/order")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("PlaceOrder")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order order)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
||||
@@ -32,13 +32,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Create user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="body">Created user object</param>
|
||||
/// <param name="user">Created user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUser")]
|
||||
public virtual IActionResult CreateUser([FromBody]User body)
|
||||
public virtual IActionResult CreateUser([FromBody]User user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@@ -50,13 +52,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithArray")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithArrayInput")]
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@@ -68,13 +72,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithList")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithListInput")]
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@@ -92,6 +98,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username)
|
||||
@@ -149,7 +156,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
||||
public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][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(..), ...
|
||||
@@ -171,6 +178,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/logout")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LogoutUser")]
|
||||
public virtual IActionResult LogoutUser()
|
||||
@@ -187,14 +195,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <param name="user">Updated user object</param>
|
||||
/// <response code="400">Invalid user supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpPut]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdateUser")]
|
||||
public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body)
|
||||
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(..), ...
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"openapi" : "3.0.1",
|
||||
"openapi" : "3.0.0",
|
||||
"info" : {
|
||||
"description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
"license" : {
|
||||
@@ -9,6 +9,10 @@
|
||||
"title" : "OpenAPI Petstore",
|
||||
"version" : "1.0.0"
|
||||
},
|
||||
"externalDocs" : {
|
||||
"description" : "Find out more about Swagger",
|
||||
"url" : "http://swagger.io"
|
||||
},
|
||||
"servers" : [ {
|
||||
"url" : "http://petstore.swagger.io/v2"
|
||||
} ],
|
||||
@@ -25,26 +29,28 @@
|
||||
"paths" : {
|
||||
"/pet" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "addPet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@@ -52,38 +58,37 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Add a new pet to the store",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"put" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Validation exception"
|
||||
}
|
||||
},
|
||||
@@ -91,8 +96,7 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Update an existing pet",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
}
|
||||
},
|
||||
"/pet/findByStatus" : {
|
||||
@@ -100,6 +104,7 @@
|
||||
"description" : "Multiple status values can be provided with comma separated strings",
|
||||
"operationId" : "findPetsByStatus",
|
||||
"parameters" : [ {
|
||||
"deprecated" : true,
|
||||
"description" : "Status values that need to be considered for filter",
|
||||
"explode" : false,
|
||||
"in" : "query",
|
||||
@@ -138,12 +143,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid status value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by status",
|
||||
"tags" : [ "pet" ]
|
||||
@@ -191,12 +195,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid tag value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by tags",
|
||||
"tags" : [ "pet" ]
|
||||
@@ -204,26 +207,31 @@
|
||||
},
|
||||
"/pet/{petId}" : {
|
||||
"delete" : {
|
||||
"description" : "",
|
||||
"operationId" : "deletePet",
|
||||
"parameters" : [ {
|
||||
"explode" : false,
|
||||
"in" : "header",
|
||||
"name" : "api_key",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}, {
|
||||
"description" : "Pet id to delete",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid pet value"
|
||||
}
|
||||
},
|
||||
@@ -238,13 +246,15 @@
|
||||
"operationId" : "getPetById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to return",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -263,11 +273,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
}
|
||||
},
|
||||
@@ -278,16 +286,19 @@
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePetWithForm",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be updated",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@@ -300,7 +311,6 @@
|
||||
},
|
||||
"responses" : {
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@@ -313,16 +323,19 @@
|
||||
},
|
||||
"/pet/{petId}/uploadImage" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "uploadFile",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to update",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@@ -381,10 +394,11 @@
|
||||
},
|
||||
"/store/order" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "placeOrder",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Order"
|
||||
}
|
||||
@@ -410,13 +424,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid Order"
|
||||
}
|
||||
},
|
||||
"summary" : "Place an order for a pet",
|
||||
"tags" : [ "store" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "store" ]
|
||||
}
|
||||
},
|
||||
"/store/order/{orderId}" : {
|
||||
@@ -425,20 +437,20 @@
|
||||
"operationId" : "deleteOrder",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of the order that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@@ -450,6 +462,7 @@
|
||||
"operationId" : "getOrderById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be fetched",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
@@ -458,7 +471,8 @@
|
||||
"maximum" : 5,
|
||||
"minimum" : 1,
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -477,11 +491,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@@ -495,7 +507,7 @@
|
||||
"operationId" : "createUser",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@@ -506,90 +518,79 @@
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Create user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithArray" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithArrayInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithList" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithListInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/login" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "loginUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The user name for login",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
}, {
|
||||
"description" : "The password for login in clear text",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "password",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -607,24 +608,36 @@
|
||||
},
|
||||
"description" : "successful operation",
|
||||
"headers" : {
|
||||
"Set-Cookie" : {
|
||||
"description" : "Cookie authentication key for use with the `api_key` apiKey authentication.",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"example" : "AUTH_KEY=abcde12345; Path=/; HttpOnly",
|
||||
"type" : "string"
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Rate-Limit" : {
|
||||
"description" : "calls per hour allowed by the user",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "int32",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Expires-After" : {
|
||||
"description" : "date in UTC when token expires",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username/password supplied"
|
||||
}
|
||||
},
|
||||
@@ -634,13 +647,16 @@
|
||||
},
|
||||
"/user/logout" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "logoutUser",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Logs out current logged in user session",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
@@ -651,36 +667,42 @@
|
||||
"operationId" : "deleteUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Delete user",
|
||||
"tags" : [ "user" ]
|
||||
},
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "getUserByName",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be fetched. Use user1 for testing.",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@@ -699,11 +721,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
@@ -715,16 +735,18 @@
|
||||
"operationId" : "updateUser",
|
||||
"parameters" : [ {
|
||||
"description" : "name that need to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@@ -735,21 +757,76 @@
|
||||
},
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid user supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
"requestBodies" : {
|
||||
"UserArray" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
},
|
||||
"Pet" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
}
|
||||
},
|
||||
"schemas" : {
|
||||
"Order" : {
|
||||
"description" : "An order for a pets from the pet store",
|
||||
@@ -806,6 +883,7 @@
|
||||
"type" : "integer"
|
||||
},
|
||||
"name" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
@@ -935,6 +1013,7 @@
|
||||
}
|
||||
},
|
||||
"status" : {
|
||||
"deprecated" : true,
|
||||
"description" : "pet status in the store",
|
||||
"enum" : [ "available", "pending", "sold" ],
|
||||
"type" : "string"
|
||||
@@ -979,7 +1058,8 @@
|
||||
"description" : "Updated status of the pet",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
},
|
||||
"uploadFile_request" : {
|
||||
"properties" : {
|
||||
@@ -992,7 +1072,8 @@
|
||||
"format" : "binary",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
}
|
||||
},
|
||||
"securitySchemes" : {
|
||||
@@ -1014,6 +1095,5 @@
|
||||
"type" : "apiKey"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-original-swagger-version" : "2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -769,6 +769,29 @@
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
|
||||
@@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -769,6 +769,29 @@
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
|
||||
Reference in New Issue
Block a user