forked from loafle/openapi-generator-original
[aspnetcore] Add TypeConverter for enum string conversion (#3557)
* Add TypeConverter for enum
This commit is contained in:
parent
42d6420400
commit
22d022b2d5
@ -327,6 +327,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
|||||||
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
|
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
|
||||||
supportingFiles.add(new SupportingFile("gitignore", packageFolder, ".gitignore"));
|
supportingFiles.add(new SupportingFile("gitignore", packageFolder, ".gitignore"));
|
||||||
supportingFiles.add(new SupportingFile("validateModel.mustache", packageFolder + File.separator + "Attributes", "ValidateModelStateAttribute.cs"));
|
supportingFiles.add(new SupportingFile("validateModel.mustache", packageFolder + File.separator + "Attributes", "ValidateModelStateAttribute.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("typeConverter.mustache", packageFolder + File.separator + "Converters", "CustomEnumConverter.cs"));
|
||||||
supportingFiles.add(new SupportingFile("Project.csproj.mustache", packageFolder, packageName + ".csproj"));
|
supportingFiles.add(new SupportingFile("Project.csproj.mustache", packageFolder, packageName + ".csproj"));
|
||||||
if (!isLibrary) {
|
if (!isLibrary) {
|
||||||
supportingFiles.add(new SupportingFile("Dockerfile.mustache", packageFolder, "Dockerfile"));
|
supportingFiles.add(new SupportingFile("Dockerfile.mustache", packageFolder, "Dockerfile"));
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
{{#description}}
|
{{#description}}
|
||||||
/// <value>{{{description}}}</value>
|
/// <value>{{{description}}}</value>
|
||||||
{{/description}}
|
{{/description}}
|
||||||
{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
|
{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}[TypeConverter(typeof(CustomEnumConverter<{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}>))]
|
||||||
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
|
||||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||||
{
|
{
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
|
@ -3,9 +3,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using {{packageName}}.Converters;
|
||||||
|
|
||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}
|
{{#model}}
|
||||||
|
33
modules/openapi-generator/src/main/resources/aspnetcore/2.1/typeConverter.mustache
vendored
Normal file
33
modules/openapi-generator/src/main/resources/aspnetcore/2.1/typeConverter.mustache
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace {{packageName}}.Converters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Custom string to enum converter
|
||||||
|
/// </summary>
|
||||||
|
public class CustomEnumConverter<T> : TypeConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||||
|
{
|
||||||
|
if (sourceType == typeof(string))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return base.CanConvertFrom(context, sourceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||||
|
{
|
||||||
|
var s = value as string;
|
||||||
|
if (string.IsNullOrEmpty(s))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @"""");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
4.0.1-SNAPSHOT
|
4.1.0-SNAPSHOT
|
@ -16,8 +16,8 @@ using Swashbuckle.AspNetCore.SwaggerGen;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Org.OpenAPITools.Attributes;
|
using Org.OpenAPITools.Attributes;
|
||||||
using Org.OpenAPITools.Models;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Org.OpenAPITools.Models;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Controllers
|
namespace Org.OpenAPITools.Controllers
|
||||||
{
|
{
|
||||||
@ -38,10 +38,10 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("AddPet")]
|
[SwaggerOperation("AddPet")]
|
||||||
public virtual IActionResult AddPet([FromBody]Pet body)
|
public virtual IActionResult AddPet([FromBody]Pet body)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(405);
|
// return StatusCode(405);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,12 +55,12 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[Route("/v2/pet/{petId}")]
|
[Route("/v2/pet/{petId}")]
|
||||||
[ValidateModelState]
|
[ValidateModelState]
|
||||||
[SwaggerOperation("DeletePet")]
|
[SwaggerOperation("DeletePet")]
|
||||||
public virtual IActionResult DeletePet([FromRoute][Required]long? petId, [FromHeader]string apiKey)
|
public virtual IActionResult DeletePet([FromRoute][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(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,12 +78,11 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
||||||
public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string> status)
|
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(..), ...
|
//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(List<Pet>));
|
// return StatusCode(200, default(List<Pet>));
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
string exampleJson = null;
|
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 = "{\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>";
|
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>";
|
||||||
@ -109,12 +108,11 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
||||||
public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string> tags)
|
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(..), ...
|
//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(List<Pet>));
|
// return StatusCode(200, default(List<Pet>));
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
string exampleJson = null;
|
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 = "{\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>";
|
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>";
|
||||||
@ -140,17 +138,15 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[ValidateModelState]
|
[ValidateModelState]
|
||||||
[SwaggerOperation("GetPetById")]
|
[SwaggerOperation("GetPetById")]
|
||||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||||
public virtual IActionResult GetPetById([FromRoute][Required]long? petId)
|
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(..), ...
|
//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));
|
// 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(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
string exampleJson = null;
|
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 = "{\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>";
|
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>";
|
||||||
@ -175,16 +171,14 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("UpdatePet")]
|
[SwaggerOperation("UpdatePet")]
|
||||||
public virtual IActionResult UpdatePet([FromBody]Pet body)
|
public virtual IActionResult UpdatePet([FromBody]Pet body)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(405);
|
// return StatusCode(405);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,12 +193,12 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[Route("/v2/pet/{petId}")]
|
[Route("/v2/pet/{petId}")]
|
||||||
[ValidateModelState]
|
[ValidateModelState]
|
||||||
[SwaggerOperation("UpdatePetWithForm")]
|
[SwaggerOperation("UpdatePetWithForm")]
|
||||||
public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long? petId, [FromForm]string name, [FromForm]string status)
|
public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(405);
|
// return StatusCode(405);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,11 +214,11 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[ValidateModelState]
|
[ValidateModelState]
|
||||||
[SwaggerOperation("UploadFile")]
|
[SwaggerOperation("UploadFile")]
|
||||||
[SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "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)
|
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(..), ...
|
//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(ApiResponse));
|
// return StatusCode(200, default(ApiResponse));
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}";
|
exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}";
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ using Swashbuckle.AspNetCore.SwaggerGen;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Org.OpenAPITools.Attributes;
|
using Org.OpenAPITools.Attributes;
|
||||||
using Org.OpenAPITools.Models;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Org.OpenAPITools.Models;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Controllers
|
namespace Org.OpenAPITools.Controllers
|
||||||
{
|
{
|
||||||
@ -40,13 +40,12 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("DeleteOrder")]
|
[SwaggerOperation("DeleteOrder")]
|
||||||
public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId)
|
public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,17 +59,17 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[Authorize(Policy = "api_key")]
|
[Authorize(Policy = "api_key")]
|
||||||
[ValidateModelState]
|
[ValidateModelState]
|
||||||
[SwaggerOperation("GetInventory")]
|
[SwaggerOperation("GetInventory")]
|
||||||
[SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int?>), description: "successful operation")]
|
[SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int>), description: "successful operation")]
|
||||||
public virtual IActionResult GetInventory()
|
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(..), ...
|
|
||||||
// return StatusCode(200, default(Dictionary<string, int?>));
|
|
||||||
|
|
||||||
|
//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(Dictionary<string, int>));
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<Dictionary<string, int?>>(exampleJson)
|
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
|
||||||
: default(Dictionary<string, int?>);
|
: default(Dictionary<string, int>);
|
||||||
//TODO: Change the data returned
|
//TODO: Change the data returned
|
||||||
return new ObjectResult(example);
|
return new ObjectResult(example);
|
||||||
}
|
}
|
||||||
@ -88,17 +87,15 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[ValidateModelState]
|
[ValidateModelState]
|
||||||
[SwaggerOperation("GetOrderById")]
|
[SwaggerOperation("GetOrderById")]
|
||||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
[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][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(..), ...
|
//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(Order));
|
// return StatusCode(200, default(Order));
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}";
|
exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}";
|
||||||
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
||||||
@ -123,12 +120,11 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
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(..), ...
|
//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(Order));
|
// return StatusCode(200, default(Order));
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}";
|
exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}";
|
||||||
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
||||||
|
@ -16,8 +16,8 @@ using Swashbuckle.AspNetCore.SwaggerGen;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Org.OpenAPITools.Attributes;
|
using Org.OpenAPITools.Attributes;
|
||||||
using Org.OpenAPITools.Models;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Org.OpenAPITools.Models;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Controllers
|
namespace Org.OpenAPITools.Controllers
|
||||||
{
|
{
|
||||||
@ -39,10 +39,10 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("CreateUser")]
|
[SwaggerOperation("CreateUser")]
|
||||||
public virtual IActionResult CreateUser([FromBody]User body)
|
public virtual IActionResult CreateUser([FromBody]User body)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(0);
|
// return StatusCode(0);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,10 +57,10 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("CreateUsersWithArrayInput")]
|
[SwaggerOperation("CreateUsersWithArrayInput")]
|
||||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body)
|
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(0);
|
// return StatusCode(0);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,10 +75,10 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("CreateUsersWithListInput")]
|
[SwaggerOperation("CreateUsersWithListInput")]
|
||||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body)
|
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(0);
|
// return StatusCode(0);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,13 +95,12 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("DeleteUser")]
|
[SwaggerOperation("DeleteUser")]
|
||||||
public virtual IActionResult DeleteUser([FromRoute][Required]string username)
|
public virtual IActionResult DeleteUser([FromRoute][Required]string username)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,15 +118,13 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")]
|
[SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")]
|
||||||
public virtual IActionResult GetUserByName([FromRoute][Required]string username)
|
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(..), ...
|
//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(User));
|
// return StatusCode(200, default(User));
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}";
|
exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}";
|
||||||
exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>";
|
exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>";
|
||||||
@ -153,12 +150,11 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
[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][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(..), ...
|
//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(string));
|
// return StatusCode(200, default(string));
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
@ -178,10 +174,10 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("LogoutUser")]
|
[SwaggerOperation("LogoutUser")]
|
||||||
public virtual IActionResult LogoutUser()
|
public virtual IActionResult LogoutUser()
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(0);
|
// return StatusCode(0);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,13 +195,12 @@ namespace Org.OpenAPITools.Controllers
|
|||||||
[SwaggerOperation("UpdateUser")]
|
[SwaggerOperation("UpdateUser")]
|
||||||
public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body)
|
public virtual IActionResult UpdateUser([FromRoute][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(..), ...
|
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(400);
|
// return StatusCode(400);
|
||||||
|
|
||||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||||
// return StatusCode(404);
|
// return StatusCode(404);
|
||||||
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Converters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Custom string to enum converter
|
||||||
|
/// </summary>
|
||||||
|
public class CustomEnumConverter<T> : TypeConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||||
|
{
|
||||||
|
if (sourceType == typeof(string))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return base.CanConvertFrom(context, sourceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||||
|
{
|
||||||
|
var s = value as string;
|
||||||
|
if (string.IsNullOrEmpty(s))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @"""");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,9 +12,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.OpenAPITools.Converters;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Models
|
namespace Org.OpenAPITools.Models
|
||||||
{
|
{
|
||||||
@ -28,7 +30,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Code
|
/// Gets or Sets Code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="code", EmitDefaultValue=false)]
|
[DataMember(Name="code", EmitDefaultValue=false)]
|
||||||
public int? Code { get; set; }
|
public int Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Type
|
/// Gets or Sets Type
|
||||||
@ -91,7 +93,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
Code == other.Code ||
|
Code == other.Code ||
|
||||||
Code != null &&
|
|
||||||
Code.Equals(other.Code)
|
Code.Equals(other.Code)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
@ -116,7 +118,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
{
|
{
|
||||||
var hashCode = 41;
|
var hashCode = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (Code != null)
|
|
||||||
hashCode = hashCode * 59 + Code.GetHashCode();
|
hashCode = hashCode * 59 + Code.GetHashCode();
|
||||||
if (Type != null)
|
if (Type != null)
|
||||||
hashCode = hashCode * 59 + Type.GetHashCode();
|
hashCode = hashCode * 59 + Type.GetHashCode();
|
||||||
|
@ -12,9 +12,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.OpenAPITools.Converters;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Models
|
namespace Org.OpenAPITools.Models
|
||||||
{
|
{
|
||||||
@ -28,7 +30,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
@ -84,7 +86,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
Id == other.Id ||
|
Id == other.Id ||
|
||||||
Id != null &&
|
|
||||||
Id.Equals(other.Id)
|
Id.Equals(other.Id)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
@ -104,7 +106,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
{
|
{
|
||||||
var hashCode = 41;
|
var hashCode = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (Id != null)
|
|
||||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||||
if (Name != null)
|
if (Name != null)
|
||||||
hashCode = hashCode * 59 + Name.GetHashCode();
|
hashCode = hashCode * 59 + Name.GetHashCode();
|
||||||
|
@ -12,9 +12,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.OpenAPITools.Converters;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Models
|
namespace Org.OpenAPITools.Models
|
||||||
{
|
{
|
||||||
@ -28,30 +30,31 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PetId
|
/// Gets or Sets PetId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="petId", EmitDefaultValue=false)]
|
[DataMember(Name="petId", EmitDefaultValue=false)]
|
||||||
public long? PetId { get; set; }
|
public long PetId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Quantity
|
/// Gets or Sets Quantity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
||||||
public int? Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ShipDate
|
/// Gets or Sets ShipDate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
||||||
public DateTime? ShipDate { get; set; }
|
public DateTime ShipDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order Status
|
/// Order Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>Order Status</value>
|
/// <value>Order Status</value>
|
||||||
|
[TypeConverter(typeof(CustomEnumConverter<StatusEnum>))]
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
public enum StatusEnum
|
public enum StatusEnum
|
||||||
{
|
{
|
||||||
@ -86,7 +89,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Complete
|
/// Gets or Sets Complete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="complete", EmitDefaultValue=false)]
|
[DataMember(Name="complete", EmitDefaultValue=false)]
|
||||||
public bool? Complete { get; set; }
|
public bool Complete { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
@ -140,17 +143,17 @@ namespace Org.OpenAPITools.Models
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
Id == other.Id ||
|
Id == other.Id ||
|
||||||
Id != null &&
|
|
||||||
Id.Equals(other.Id)
|
Id.Equals(other.Id)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
PetId == other.PetId ||
|
PetId == other.PetId ||
|
||||||
PetId != null &&
|
|
||||||
PetId.Equals(other.PetId)
|
PetId.Equals(other.PetId)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
Quantity == other.Quantity ||
|
Quantity == other.Quantity ||
|
||||||
Quantity != null &&
|
|
||||||
Quantity.Equals(other.Quantity)
|
Quantity.Equals(other.Quantity)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
@ -165,7 +168,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
Complete == other.Complete ||
|
Complete == other.Complete ||
|
||||||
Complete != null &&
|
|
||||||
Complete.Equals(other.Complete)
|
Complete.Equals(other.Complete)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -180,17 +183,17 @@ namespace Org.OpenAPITools.Models
|
|||||||
{
|
{
|
||||||
var hashCode = 41;
|
var hashCode = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (Id != null)
|
|
||||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||||
if (PetId != null)
|
|
||||||
hashCode = hashCode * 59 + PetId.GetHashCode();
|
hashCode = hashCode * 59 + PetId.GetHashCode();
|
||||||
if (Quantity != null)
|
|
||||||
hashCode = hashCode * 59 + Quantity.GetHashCode();
|
hashCode = hashCode * 59 + Quantity.GetHashCode();
|
||||||
if (ShipDate != null)
|
if (ShipDate != null)
|
||||||
hashCode = hashCode * 59 + ShipDate.GetHashCode();
|
hashCode = hashCode * 59 + ShipDate.GetHashCode();
|
||||||
|
|
||||||
hashCode = hashCode * 59 + Status.GetHashCode();
|
hashCode = hashCode * 59 + Status.GetHashCode();
|
||||||
if (Complete != null)
|
|
||||||
hashCode = hashCode * 59 + Complete.GetHashCode();
|
hashCode = hashCode * 59 + Complete.GetHashCode();
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.OpenAPITools.Converters;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Models
|
namespace Org.OpenAPITools.Models
|
||||||
{
|
{
|
||||||
@ -28,7 +30,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Category
|
/// Gets or Sets Category
|
||||||
@ -60,6 +62,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// pet status in the store
|
/// pet status in the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>pet status in the store</value>
|
/// <value>pet status in the store</value>
|
||||||
|
[TypeConverter(typeof(CustomEnumConverter<StatusEnum>))]
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
public enum StatusEnum
|
public enum StatusEnum
|
||||||
{
|
{
|
||||||
@ -142,7 +145,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
Id == other.Id ||
|
Id == other.Id ||
|
||||||
Id != null &&
|
|
||||||
Id.Equals(other.Id)
|
Id.Equals(other.Id)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
@ -184,7 +187,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
{
|
{
|
||||||
var hashCode = 41;
|
var hashCode = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (Id != null)
|
|
||||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||||
if (Category != null)
|
if (Category != null)
|
||||||
hashCode = hashCode * 59 + Category.GetHashCode();
|
hashCode = hashCode * 59 + Category.GetHashCode();
|
||||||
|
@ -12,9 +12,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.OpenAPITools.Converters;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Models
|
namespace Org.OpenAPITools.Models
|
||||||
{
|
{
|
||||||
@ -28,7 +30,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
@ -84,7 +86,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
Id == other.Id ||
|
Id == other.Id ||
|
||||||
Id != null &&
|
|
||||||
Id.Equals(other.Id)
|
Id.Equals(other.Id)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
@ -104,7 +106,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
{
|
{
|
||||||
var hashCode = 41;
|
var hashCode = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (Id != null)
|
|
||||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||||
if (Name != null)
|
if (Name != null)
|
||||||
hashCode = hashCode * 59 + Name.GetHashCode();
|
hashCode = hashCode * 59 + Name.GetHashCode();
|
||||||
|
@ -12,9 +12,11 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.OpenAPITools.Converters;
|
||||||
|
|
||||||
namespace Org.OpenAPITools.Models
|
namespace Org.OpenAPITools.Models
|
||||||
{
|
{
|
||||||
@ -28,7 +30,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Username
|
/// Gets or Sets Username
|
||||||
@ -71,7 +73,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>User Status</value>
|
/// <value>User Status</value>
|
||||||
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
||||||
public int? UserStatus { get; set; }
|
public int UserStatus { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
@ -127,7 +129,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
Id == other.Id ||
|
Id == other.Id ||
|
||||||
Id != null &&
|
|
||||||
Id.Equals(other.Id)
|
Id.Equals(other.Id)
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
@ -162,7 +164,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
UserStatus == other.UserStatus ||
|
UserStatus == other.UserStatus ||
|
||||||
UserStatus != null &&
|
|
||||||
UserStatus.Equals(other.UserStatus)
|
UserStatus.Equals(other.UserStatus)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -177,7 +179,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
{
|
{
|
||||||
var hashCode = 41;
|
var hashCode = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (Id != null)
|
|
||||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||||
if (Username != null)
|
if (Username != null)
|
||||||
hashCode = hashCode * 59 + Username.GetHashCode();
|
hashCode = hashCode * 59 + Username.GetHashCode();
|
||||||
@ -191,7 +193,7 @@ namespace Org.OpenAPITools.Models
|
|||||||
hashCode = hashCode * 59 + Password.GetHashCode();
|
hashCode = hashCode * 59 + Password.GetHashCode();
|
||||||
if (Phone != null)
|
if (Phone != null)
|
||||||
hashCode = hashCode * 59 + Phone.GetHashCode();
|
hashCode = hashCode * 59 + Phone.GetHashCode();
|
||||||
if (UserStatus != null)
|
|
||||||
hashCode = hashCode * 59 + UserStatus.GetHashCode();
|
hashCode = hashCode * 59 + UserStatus.GetHashCode();
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user