forked from loafle/openapi-generator-original
Bugfixes/12952 fix newtonsoft using (#15515)
* Fix #12952: Handle useNewtonsoft parameter correctly Next commit will have all modified samples. * Fix #12952: Add generated samples * Fix #12952: Add missing files
This commit is contained in:
committed by
GitHub
parent
fbf42de200
commit
edad90e794
9
bin/configs/aspnetcore-6.0-NewtonsoftFalse.yaml
Normal file
9
bin/configs/aspnetcore-6.0-NewtonsoftFalse.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-6.0-useNewtonsoft
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "6.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
useNewtonsoft: false
|
||||
@@ -410,7 +410,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
if (useSeparateModelProject)
|
||||
{
|
||||
supportingFiles.add(new SupportingFile("typeConverter.mustache", sourceFolder + File.separator + modelPackage + File.separator + "Converters", "CustomEnumConverter.cs"));
|
||||
String separateModelSeparator = sourceFolder + File.separator + modelPackage ;
|
||||
supportingFiles.add(new SupportingFile("gitignore", separateModelSeparator, ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("typeConverter.mustache", separateModelSeparator + File.separator + "Converters", "CustomEnumConverter.cs"));
|
||||
supportingFiles.add(new SupportingFile("ModelsProject.csproj.mustache", separateModelSeparator, modelPackage + ".csproj"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("typeConverter.mustache", packageFolder + File.separator + "Converters", "CustomEnumConverter.cs"));
|
||||
}
|
||||
@@ -419,11 +422,6 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("OpenApi" + File.separator + "TypeExtensions.mustache", packageFolder + File.separator + "OpenApi", "TypeExtensions.cs"));
|
||||
}
|
||||
|
||||
if (useSeparateModelProject)
|
||||
{
|
||||
supportingFiles.add(new SupportingFile("ModelsProject.csproj.mustache", sourceFolder + File.separator + modelPackage, modelPackage + ".csproj"));
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("Project.csproj.mustache", packageFolder, packageName + ".csproj"));
|
||||
if (!isLibrary) {
|
||||
supportingFiles.add(new SupportingFile("Dockerfile.mustache", packageFolder, "Dockerfile"));
|
||||
|
||||
@@ -15,6 +15,10 @@ using Microsoft.OpenApi.Models;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
{{/useNewtonsoft}}
|
||||
using {{packageName}}.Authentication;
|
||||
{{#useSwashbuckle}}
|
||||
using {{packageName}}.Filters;
|
||||
@@ -73,16 +77,24 @@ namespace {{packageName}}
|
||||
// Don't need this for 3.x - see https://docs.microsoft.com/en-us/aspnet/core/mvc/compatibility-version?view=aspnetcore-3.1
|
||||
//.SetCompatibilityVersion(CompatibilityVersion.{{.}})
|
||||
{{/compatibilityVersion}}
|
||||
.{{#useNewtonsoft}}AddNewtonsoftJson{{/useNewtonsoft}}{{^useNewtonsoft}}AddJsonOptions{{/useNewtonsoft}}(opts =>
|
||||
{{#useNewtonsoft}}
|
||||
.AddNewtonsoftJson(opts =>
|
||||
{
|
||||
opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||
opts.SerializerSettings.Converters.Add(new StringEnumConverter
|
||||
{
|
||||
{{#useNewtonsoft}}NamingStrategy = new CamelCaseNamingStrategy(){{/useNewtonsoft}}{{^useNewtonsoft}}CamelCaseText = true{{/useNewtonsoft}}
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
});
|
||||
});
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
|
||||
});
|
||||
{{/useNewtonsoft}}
|
||||
{{#useSwashbuckle}}
|
||||
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
@@ -14,7 +14,12 @@ using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
{{/useSwashbuckle}}
|
||||
{{^isLibrary}}
|
||||
{{#useNewtonsoft}}
|
||||
using Newtonsoft.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
using System.Text.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{/isLibrary}}
|
||||
using {{packageName}}.Attributes;
|
||||
using {{modelPackage}};
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
{{#description}}
|
||||
/// <value>{{{.}}}</value>
|
||||
{{/description}}
|
||||
{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}[TypeConverter(typeof(CustomEnumConverter<{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}>))]
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
|
||||
{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}{{#useNewtonsoft}}[TypeConverter(typeof(CustomEnumConverter<{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}>))]
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]{{/useNewtonsoft}}{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
|
||||
public enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||
{
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<{{returnContainer}}<{{{returnType}}}>>(exampleJson)
|
||||
? {{#useNewtonsoft}}JsonConvert.DeserializeObject{{/useNewtonsoft}}{{^useNewtonsoft}}JsonSerializer.Deserialize{{/useNewtonsoft}}<{{returnContainer}}<{{{returnType}}}>>(exampleJson)
|
||||
: Enumerable.Empty<{{{returnType}}}>();
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
|
||||
? {{#useNewtonsoft}}JsonConvert.DeserializeObject{{/useNewtonsoft}}{{^useNewtonsoft}}JsonSerializer.Deserialize{{/useNewtonsoft}}<{{{returnType}}}>(exampleJson)
|
||||
: new {{{returnType}}}();
|
||||
@@ -6,7 +6,12 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
{{#useNewtonsoft}}
|
||||
using Newtonsoft.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
using System.Text.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#discriminator}}
|
||||
@@ -28,7 +33,7 @@ namespace {{modelPackage}}
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
{{#discriminator}}
|
||||
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
|
||||
{{#useNewtonsoft}}[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]{{/useNewtonsoft}}
|
||||
{{#useSwashbuckle}}
|
||||
[SwaggerDiscriminator("{{{discriminatorName}}}")]
|
||||
{{/useSwashbuckle}}
|
||||
@@ -99,7 +104,17 @@ namespace {{modelPackage}}
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public {{#parent}}{{^isMap}}{{^isArray}}new {{/isArray}}{{/isMap}}{{/parent}}string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
{{#useNewtonsoft}}
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
{{/useNewtonsoft}}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
|
||||
? {{#useNewtonsoft}}JsonConvert.DeserializeObject{{/useNewtonsoft}}{{^useNewtonsoft}}JsonSerializer.Deserialize{{/useNewtonsoft}}<{{{returnType}}}>(exampleJson)
|
||||
: default({{{returnType}}});
|
||||
@@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
{{#useNewtonsoft}}
|
||||
using Newtonsoft.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
using System.Text.Json;
|
||||
{{/useNewtonsoft}}
|
||||
|
||||
namespace {{packageName}}.Converters
|
||||
{
|
||||
@@ -36,7 +41,7 @@ namespace {{packageName}}.Converters
|
||||
return null;
|
||||
}
|
||||
|
||||
return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @"""");
|
||||
return {{#useNewtonsoft}}JsonConvert.DeserializeObject{{/useNewtonsoft}}{{^useNewtonsoft}}JsonSerializer.Deserialize{{/useNewtonsoft}}<T>(@"""" + value.ToString() + @"""");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Org.OpenAPITools
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
});
|
||||
});
|
||||
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Org.OpenAPITools
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
});
|
||||
});
|
||||
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Org.OpenAPITools
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
});
|
||||
});
|
||||
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Org.OpenAPITools
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
});
|
||||
});
|
||||
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
362
samples/server/petstore/aspnetcore-6.0-project4Models/src/Org.OpenAPITools.Models/.gitignore
vendored
Normal file
362
samples/server/petstore/aspnetcore-6.0-project4Models/src/Org.OpenAPITools.Models/.gitignore
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
@@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Org.OpenAPITools
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
});
|
||||
});
|
||||
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
@@ -0,0 +1,37 @@
|
||||
Org.OpenAPITools.sln
|
||||
README.md
|
||||
build.bat
|
||||
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
|
||||
src/Org.OpenAPITools/Converters/CustomEnumConverter.cs
|
||||
src/Org.OpenAPITools/Dockerfile
|
||||
src/Org.OpenAPITools/Filters/BasePathFilter.cs
|
||||
src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs
|
||||
src/Org.OpenAPITools/Formatters/InputFormatterStream.cs
|
||||
src/Org.OpenAPITools/Models/Animal.cs
|
||||
src/Org.OpenAPITools/Models/ApiResponse.cs
|
||||
src/Org.OpenAPITools/Models/Cat.cs
|
||||
src/Org.OpenAPITools/Models/CatAllOf.cs
|
||||
src/Org.OpenAPITools/Models/Category.cs
|
||||
src/Org.OpenAPITools/Models/Dog.cs
|
||||
src/Org.OpenAPITools/Models/DogAllOf.cs
|
||||
src/Org.OpenAPITools/Models/Order.cs
|
||||
src/Org.OpenAPITools/Models/Pet.cs
|
||||
src/Org.OpenAPITools/Models/Tag.cs
|
||||
src/Org.OpenAPITools/Models/User.cs
|
||||
src/Org.OpenAPITools/OpenApi/TypeExtensions.cs
|
||||
src/Org.OpenAPITools/Org.OpenAPITools.csproj
|
||||
src/Org.OpenAPITools/Program.cs
|
||||
src/Org.OpenAPITools/Properties/launchSettings.json
|
||||
src/Org.OpenAPITools/Startup.cs
|
||||
src/Org.OpenAPITools/appsettings.Development.json
|
||||
src/Org.OpenAPITools/appsettings.json
|
||||
src/Org.OpenAPITools/wwwroot/README.md
|
||||
src/Org.OpenAPITools/wwwroot/index.html
|
||||
src/Org.OpenAPITools/wwwroot/openapi-original.json
|
||||
@@ -0,0 +1 @@
|
||||
7.0.0-SNAPSHOT
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27428.2043
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3C799344-F285-4669-8FD5-7ED9B795D5C5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,50 @@
|
||||
# Org.OpenAPITools - ASP.NET Core 6.0 Server
|
||||
|
||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
## Upgrade NuGet Packages
|
||||
|
||||
NuGet packages get frequently updated.
|
||||
|
||||
To upgrade this solution to the latest version of all NuGet packages, use the dotnet-outdated tool.
|
||||
|
||||
|
||||
Install dotnet-outdated tool:
|
||||
|
||||
```
|
||||
dotnet tool install --global dotnet-outdated-tool
|
||||
```
|
||||
|
||||
Upgrade only to new minor versions of packages
|
||||
|
||||
```
|
||||
dotnet outdated --upgrade --version-lock Major
|
||||
```
|
||||
|
||||
Upgrade to all new versions of packages (more likely to include breaking API changes)
|
||||
|
||||
```
|
||||
dotnet outdated --upgrade
|
||||
```
|
||||
|
||||
|
||||
## Run
|
||||
|
||||
Linux/OS X:
|
||||
|
||||
```
|
||||
sh build.sh
|
||||
```
|
||||
|
||||
Windows:
|
||||
|
||||
```
|
||||
build.bat
|
||||
```
|
||||
## Run in Docker
|
||||
|
||||
```
|
||||
cd src/Org.OpenAPITools
|
||||
docker build -t org.openapitools .
|
||||
docker run -p 5000:8080 org.openapitools
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
:: Generated by: https://openapi-generator.tech
|
||||
::
|
||||
|
||||
@echo off
|
||||
|
||||
dotnet restore src\Org.OpenAPITools
|
||||
dotnet build src\Org.OpenAPITools
|
||||
echo Now, run the following to start the project: dotnet run -p src\Org.OpenAPITools\Org.OpenAPITools.csproj --launch-profile web.
|
||||
echo.
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Generated by: https://openapi-generator.tech
|
||||
#
|
||||
|
||||
dotnet restore src/Org.OpenAPITools/ && \
|
||||
dotnet build src/Org.OpenAPITools/ && \
|
||||
echo "Now, run the following to start the project: dotnet run -p src/Org.OpenAPITools/Org.OpenAPITools.csproj --launch-profile web"
|
||||
362
samples/server/petstore/aspnetcore-6.0-useNewtonsoft/src/Org.OpenAPITools/.gitignore
vendored
Normal file
362
samples/server/petstore/aspnetcore-6.0-useNewtonsoft/src/Org.OpenAPITools/.gitignore
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
namespace Org.OpenAPITools.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Model state validation attribute
|
||||
/// </summary>
|
||||
public class ValidateModelStateAttribute : ActionFilterAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Called before the action method is invoked
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
// Per https://blog.markvincze.com/how-to-validate-action-parameters-with-dataannotation-attributes/
|
||||
var descriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||
if (descriptor != null)
|
||||
{
|
||||
foreach (var parameter in descriptor.MethodInfo.GetParameters())
|
||||
{
|
||||
object args = null;
|
||||
if (context.ActionArguments.ContainsKey(parameter.Name))
|
||||
{
|
||||
args = context.ActionArguments[parameter.Name];
|
||||
}
|
||||
|
||||
ValidateAttributes(parameter, args, context.ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
if (!context.ModelState.IsValid)
|
||||
{
|
||||
context.Result = new BadRequestObjectResult(context.ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateAttributes(ParameterInfo parameter, object args, ModelStateDictionary modelState)
|
||||
{
|
||||
foreach (var attributeData in parameter.CustomAttributes)
|
||||
{
|
||||
var attributeInstance = parameter.GetCustomAttribute(attributeData.AttributeType);
|
||||
|
||||
var validationAttribute = attributeInstance as ValidationAttribute;
|
||||
if (validationAttribute != null)
|
||||
{
|
||||
var isValid = validationAttribute.IsValid(args);
|
||||
if (!isValid)
|
||||
{
|
||||
modelState.AddModelError(parameter.Name, validationAttribute.FormatErrorMessage(parameter.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace Org.OpenAPITools.Authentication
|
||||
{
|
||||
/// <summary>
|
||||
/// A requirement that an ApiKey must be present.
|
||||
/// </summary>
|
||||
public class ApiKeyRequirement : IAuthorizationRequirement
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the list of api keys
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> ApiKeys { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the policy name,
|
||||
/// </summary>
|
||||
public string PolicyName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new instance of the <see cref="ApiKeyRequirement"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiKeys"></param>
|
||||
/// <param name="policyName"></param>
|
||||
public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName)
|
||||
{
|
||||
ApiKeys = apiKeys?.ToList() ?? new List<string>();
|
||||
PolicyName = policyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enforce that an api key is present.
|
||||
/// </summary>
|
||||
public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement>
|
||||
{
|
||||
/// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" />
|
||||
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement)
|
||||
{
|
||||
SucceedRequirementIfApiKeyPresentAndValid(context, requirement);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement)
|
||||
{
|
||||
|
||||
if (context.Resource is AuthorizationFilterContext authorizationFilterContext)
|
||||
{
|
||||
var apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault();
|
||||
if (requirement.PolicyName == "api_key" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey))
|
||||
{
|
||||
context.Succeed(requirement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 System.Text.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
* 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 System.Text.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class PetApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
/// <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")]
|
||||
[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);
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a pet
|
||||
/// </summary>
|
||||
/// <param name="petId">Pet id to delete</param>
|
||||
/// <param name="apiKey"></param>
|
||||
/// <response code="400">Invalid pet value</response>
|
||||
[HttpDelete]
|
||||
[Route("/v2/pet/{petId}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("DeletePet")]
|
||||
public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader]string apiKey)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(400);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 (deprecated)</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/pet/findByStatus")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FindPetsByStatus")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
||||
public virtual IActionResult FindPetsByStatus([FromQuery (Name = "status")][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(..), ...
|
||||
// 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(..), ...
|
||||
// return StatusCode(400);
|
||||
string exampleJson = null;
|
||||
exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<List<Pet>>(exampleJson)
|
||||
: default(List<Pet>);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by tags
|
||||
/// </summary>
|
||||
/// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid tag value</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/pet/findByTags")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FindPetsByTags")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
|
||||
[Obsolete]
|
||||
public virtual IActionResult FindPetsByTags([FromQuery (Name = "tags")][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(..), ...
|
||||
// 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(..), ...
|
||||
// return StatusCode(400);
|
||||
string exampleJson = null;
|
||||
exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<List<Pet>>(exampleJson)
|
||||
: default(List<Pet>);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find pet by ID
|
||||
/// </summary>
|
||||
/// <remarks>Returns a single pet</remarks>
|
||||
/// <param name="petId">ID of pet to return</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/pet/{petId}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetPetById")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// 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);
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <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>
|
||||
[HttpPut]
|
||||
[Route("/v2/pet")]
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
[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);
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\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
|
||||
? JsonSerializer.Deserialize<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a pet in the store with form data
|
||||
/// </summary>
|
||||
/// <param name="petId">ID of pet that needs to be updated</param>
|
||||
/// <param name="name">Updated name of the pet</param>
|
||||
/// <param name="status">Updated status of the pet</param>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/pet/{petId}")]
|
||||
[Consumes("application/x-www-form-urlencoded")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdatePetWithForm")]
|
||||
public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// uploads an image
|
||||
/// </summary>
|
||||
/// <param name="petId">ID of pet to update</param>
|
||||
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
||||
/// <param name="file">file to upload</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/pet/{petId}/uploadImage")]
|
||||
[Consumes("multipart/form-data")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UploadFile")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")]
|
||||
public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, IFormFile file)
|
||||
{
|
||||
|
||||
//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));
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"code\" : 0,\r\n \"type\" : \"type\",\r\n \"message\" : \"message\"\r\n}";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<ApiResponse>(exampleJson)
|
||||
: default(ApiResponse);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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 System.Text.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class StoreApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Delete purchase order by ID
|
||||
/// </summary>
|
||||
/// <remarks>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</remarks>
|
||||
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Order not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/v2/store/order/{orderId}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("DeleteOrder")]
|
||||
public virtual IActionResult DeleteOrder([FromRoute (Name = "orderId")][Required]string orderId)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// 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);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns pet inventories by status
|
||||
/// </summary>
|
||||
/// <remarks>Returns a map of status codes to quantities</remarks>
|
||||
/// <response code="200">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/store/inventory")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetInventory")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int>), description: "successful operation")]
|
||||
public virtual IActionResult GetInventory()
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Dictionary<string, int>));
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<Dictionary<string, int>>(exampleJson)
|
||||
: new Dictionary<string, int>();
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find purchase order by ID
|
||||
/// </summary>
|
||||
/// <remarks>For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions</remarks>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Order not found</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/store/order/{orderId}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetOrderById")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult GetOrderById([FromRoute (Name = "orderId")][Required][Range(1, 5)]long orderId)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// 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(..), ...
|
||||
// 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);
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"petId\" : 6,\r\n \"quantity\" : 1,\r\n \"id\" : 0,\r\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"complete\" : false,\r\n \"status\" : \"placed\"\r\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>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<Order>(exampleJson)
|
||||
: default(Order);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <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 order)
|
||||
{
|
||||
|
||||
//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));
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(400);
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"petId\" : 6,\r\n \"quantity\" : 1,\r\n \"id\" : 0,\r\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"complete\" : false,\r\n \"status\" : \"placed\"\r\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>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<Order>(exampleJson)
|
||||
: default(Order);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* 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 System.Text.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class UserApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Create user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <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 user)
|
||||
{
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <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> user)
|
||||
{
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <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> user)
|
||||
{
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">The name that needs to be deleted</param>
|
||||
/// <response code="400">Invalid username supplied</response>
|
||||
/// <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)
|
||||
{
|
||||
|
||||
//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);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get user by user name
|
||||
/// </summary>
|
||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid username supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/{username}")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("GetUserByName")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")]
|
||||
public virtual IActionResult GetUserByName([FromRoute (Name = "username")][Required]string username)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// 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(..), ...
|
||||
// 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);
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\r\n \"firstName\" : \"firstName\",\r\n \"lastName\" : \"lastName\",\r\n \"password\" : \"password\",\r\n \"userStatus\" : 6,\r\n \"phone\" : \"phone\",\r\n \"id\" : 0,\r\n \"email\" : \"email\",\r\n \"username\" : \"username\"\r\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>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<User>(exampleJson)
|
||||
: default(User);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs user into the system
|
||||
/// </summary>
|
||||
/// <param name="username">The user name for login</param>
|
||||
/// <param name="password">The password for login in clear text</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid username/password supplied</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/login")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
||||
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(..), ...
|
||||
// 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(..), ...
|
||||
// return StatusCode(400);
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonSerializer.Deserialize<string>(exampleJson)
|
||||
: default(string);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs out current logged in user session
|
||||
/// </summary>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/logout")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("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(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updated user
|
||||
/// </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="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 user)
|
||||
{
|
||||
|
||||
//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);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Org.OpenAPITools.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom string to enum converter
|
||||
/// </summary>
|
||||
public class CustomEnumConverter<T> : TypeConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Determine if we can convert a type to an enum
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="sourceType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert from a type value to an enum
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
var s = value as string;
|
||||
if (string.IsNullOrEmpty(s))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return JsonSerializer.Deserialize<T>(@"""" + value.ToString() + @"""");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
# Container we use for final publish
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:6.0-buster-slim AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
# Build container
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:6.0-buster AS build
|
||||
|
||||
# Copy the code into the container
|
||||
WORKDIR /src
|
||||
COPY ["src/Org.OpenAPITools/Org.OpenAPITools.csproj", "Org.OpenAPITools/"]
|
||||
|
||||
# NuGet restore
|
||||
RUN dotnet restore "Org.OpenAPITools/Org.OpenAPITools.csproj"
|
||||
COPY ["src/Org.OpenAPITools/", "Org.OpenAPITools/"]
|
||||
|
||||
# Build the API
|
||||
WORKDIR "Org.OpenAPITools"
|
||||
RUN dotnet build "Org.OpenAPITools.csproj" -c Release -o /app/build
|
||||
|
||||
# Publish it
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "Org.OpenAPITools.csproj" -c Release -o /app/publish
|
||||
|
||||
# Make the final image for publishing
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "Org.OpenAPITools.dll"]
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace Org.OpenAPITools.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// BasePath Document Filter sets BasePath property of OpenAPI and removes it from the individual URL paths
|
||||
/// </summary>
|
||||
public class BasePathFilter : IDocumentFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="basePath">BasePath to remove from Operations</param>
|
||||
public BasePathFilter(string basePath)
|
||||
{
|
||||
BasePath = basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the BasePath of the OpenAPI Doc
|
||||
/// </summary>
|
||||
/// <returns>The BasePath of the OpenAPI Doc</returns>
|
||||
public string BasePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Apply the filter
|
||||
/// </summary>
|
||||
/// <param name="openapiDoc">OpenApiDocument</param>
|
||||
/// <param name="context">FilterContext</param>
|
||||
public void Apply(OpenApiDocument openapiDoc, DocumentFilterContext context)
|
||||
{
|
||||
//openapiDoc.BasePath = BasePath;
|
||||
|
||||
var pathsToModify = openapiDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList();
|
||||
|
||||
foreach (var (key, value) in pathsToModify)
|
||||
{
|
||||
if (key.StartsWith(BasePath))
|
||||
{
|
||||
var newKey = Regex.Replace(key, $"^{BasePath}", string.Empty);
|
||||
openapiDoc.Paths.Remove(key);
|
||||
openapiDoc.Paths.Add(newKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace Org.OpenAPITools.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Path Parameter Validation Rules Filter
|
||||
/// </summary>
|
||||
public class GeneratePathParamsValidationFilter : IOperationFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="operation">Operation</param>
|
||||
/// <param name="context">OperationFilterContext</param>
|
||||
public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
||||
{
|
||||
var pars = context.ApiDescription.ParameterDescriptions;
|
||||
|
||||
foreach (var par in pars)
|
||||
{
|
||||
var openapiParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name);
|
||||
|
||||
var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes.ToList();
|
||||
|
||||
// See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1147
|
||||
// and https://mikeralphson.github.io/openapi/2017/03/15/openapi3.0.0-rc0
|
||||
// Basically OpenAPI v3 body parameters are split out into RequestBody and the properties have moved to schema
|
||||
if (attributes.Any() && openapiParam != null)
|
||||
{
|
||||
// Required - [Required]
|
||||
var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute));
|
||||
if (requiredAttr != null)
|
||||
{
|
||||
openapiParam.Required = true;
|
||||
}
|
||||
|
||||
// Regex Pattern [RegularExpression]
|
||||
var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute));
|
||||
if (regexAttr != null)
|
||||
{
|
||||
var regex = (string)regexAttr.ConstructorArguments[0].Value;
|
||||
openapiParam.Schema.Pattern = regex;
|
||||
}
|
||||
|
||||
// String Length [StringLength]
|
||||
int? minLength = null, maxLength = null;
|
||||
var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute));
|
||||
if (stringLengthAttr != null)
|
||||
{
|
||||
if (stringLengthAttr.NamedArguments.Count == 1)
|
||||
{
|
||||
minLength = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value;
|
||||
}
|
||||
maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value;
|
||||
}
|
||||
|
||||
var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute));
|
||||
if (minLengthAttr != null)
|
||||
{
|
||||
minLength = (int)minLengthAttr.ConstructorArguments[0].Value;
|
||||
}
|
||||
|
||||
var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute));
|
||||
if (maxLengthAttr != null)
|
||||
{
|
||||
maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value;
|
||||
}
|
||||
|
||||
if (minLength != null)
|
||||
{
|
||||
openapiParam.Schema.MinLength = minLength;
|
||||
}
|
||||
|
||||
if (maxLength != null)
|
||||
{
|
||||
openapiParam.Schema.MaxLength = maxLength;
|
||||
}
|
||||
|
||||
// Range [Range]
|
||||
var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute));
|
||||
if (rangeAttr != null)
|
||||
{
|
||||
var rangeMin = (int)rangeAttr.ConstructorArguments[0].Value;
|
||||
var rangeMax = (int)rangeAttr.ConstructorArguments[1].Value;
|
||||
|
||||
openapiParam.Schema.MinLength = rangeMin;
|
||||
openapiParam.Schema.MaxLength = rangeMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
|
||||
namespace Org.OpenAPITools.Formatters
|
||||
{
|
||||
// Input Type Formatter to allow model binding to Streams
|
||||
public class InputFormatterStream : InputFormatter
|
||||
{
|
||||
public InputFormatterStream()
|
||||
{
|
||||
SupportedMediaTypes.Add("application/octet-stream");
|
||||
SupportedMediaTypes.Add("image/jpeg");
|
||||
}
|
||||
|
||||
protected override bool CanReadType(Type type)
|
||||
{
|
||||
if (type == typeof(Stream))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
|
||||
{
|
||||
return InputFormatterResult.SuccessAsync(context.HttpContext.Request.Body);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using JsonSubTypes;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
|
||||
[SwaggerDiscriminator("ClassName")]
|
||||
[JsonSubtypes.KnownSubType(typeof(Cat), "CAT")]
|
||||
[SwaggerSubType(typeof(Cat), DiscriminatorValue = "CAT")]
|
||||
[JsonSubtypes.KnownSubType(typeof(Dog), "DOG")]
|
||||
[SwaggerSubType(typeof(Dog), DiscriminatorValue = "DOG")]
|
||||
public partial class Animal : IEquatable<Animal>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[Required]
|
||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Color
|
||||
/// </summary>
|
||||
[DataMember(Name="color", EmitDefaultValue=false)]
|
||||
public string Color { get; set; } = "red";
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Animal {\n");
|
||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
||||
sb.Append(" Color: ").Append(Color).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Animal)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Animal instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Animal to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Animal other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
ClassName == other.ClassName ||
|
||||
ClassName != null &&
|
||||
ClassName.Equals(other.ClassName)
|
||||
) &&
|
||||
(
|
||||
Color == other.Color ||
|
||||
Color != null &&
|
||||
Color.Equals(other.Color)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
if (ClassName != null)
|
||||
hashCode = hashCode * 59 + ClassName.GetHashCode();
|
||||
if (Color != null)
|
||||
hashCode = hashCode * 59 + Color.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Animal left, Animal right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Animal left, Animal right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the result of uploading an image resource
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class ApiResponse : IEquatable<ApiResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Code
|
||||
/// </summary>
|
||||
[DataMember(Name="code", EmitDefaultValue=true)]
|
||||
public int Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Type
|
||||
/// </summary>
|
||||
[DataMember(Name="type", EmitDefaultValue=false)]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Message
|
||||
/// </summary>
|
||||
[DataMember(Name="message", EmitDefaultValue=false)]
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class ApiResponse {\n");
|
||||
sb.Append(" Code: ").Append(Code).Append("\n");
|
||||
sb.Append(" Type: ").Append(Type).Append("\n");
|
||||
sb.Append(" Message: ").Append(Message).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((ApiResponse)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if ApiResponse instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of ApiResponse to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(ApiResponse other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Code == other.Code ||
|
||||
|
||||
Code.Equals(other.Code)
|
||||
) &&
|
||||
(
|
||||
Type == other.Type ||
|
||||
Type != null &&
|
||||
Type.Equals(other.Type)
|
||||
) &&
|
||||
(
|
||||
Message == other.Message ||
|
||||
Message != null &&
|
||||
Message.Equals(other.Message)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Code.GetHashCode();
|
||||
if (Type != null)
|
||||
hashCode = hashCode * 59 + Type.GetHashCode();
|
||||
if (Message != null)
|
||||
hashCode = hashCode * 59 + Message.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(ApiResponse left, ApiResponse right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(ApiResponse left, ApiResponse right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Cat : Animal, IEquatable<Cat>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Declawed
|
||||
/// </summary>
|
||||
[DataMember(Name="declawed", EmitDefaultValue=true)]
|
||||
public bool Declawed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Cat {\n");
|
||||
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Cat)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Cat instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Cat to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Cat other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Declawed == other.Declawed ||
|
||||
|
||||
Declawed.Equals(other.Declawed)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Declawed.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Cat left, Cat right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Cat left, Cat right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class CatAllOf : IEquatable<CatAllOf>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Declawed
|
||||
/// </summary>
|
||||
[DataMember(Name="declawed", EmitDefaultValue=true)]
|
||||
public bool Declawed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class CatAllOf {\n");
|
||||
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((CatAllOf)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if CatAllOf instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of CatAllOf to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(CatAllOf other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Declawed == other.Declawed ||
|
||||
|
||||
Declawed.Equals(other.Declawed)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Declawed.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(CatAllOf left, CatAllOf right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(CatAllOf left, CatAllOf right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A category for a pet
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Category : IEquatable<Category>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <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; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Category {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Category)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Category instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Category to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Category other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Id == other.Id ||
|
||||
|
||||
Id.Equals(other.Id)
|
||||
) &&
|
||||
(
|
||||
Name == other.Name ||
|
||||
Name != null &&
|
||||
Name.Equals(other.Name)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||
if (Name != null)
|
||||
hashCode = hashCode * 59 + Name.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Category left, Category right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Category left, Category right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Dog : Animal, IEquatable<Dog>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Breed
|
||||
/// </summary>
|
||||
[DataMember(Name="breed", EmitDefaultValue=false)]
|
||||
public string Breed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Dog {\n");
|
||||
sb.Append(" Breed: ").Append(Breed).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public new string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Dog)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Dog instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Dog to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Dog other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Breed == other.Breed ||
|
||||
Breed != null &&
|
||||
Breed.Equals(other.Breed)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
if (Breed != null)
|
||||
hashCode = hashCode * 59 + Breed.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Dog left, Dog right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Dog left, Dog right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class DogAllOf : IEquatable<DogAllOf>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Breed
|
||||
/// </summary>
|
||||
[DataMember(Name="breed", EmitDefaultValue=false)]
|
||||
public string Breed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class DogAllOf {\n");
|
||||
sb.Append(" Breed: ").Append(Breed).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((DogAllOf)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if DogAllOf instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of DogAllOf to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(DogAllOf other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Breed == other.Breed ||
|
||||
Breed != null &&
|
||||
Breed.Equals(other.Breed)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
if (Breed != null)
|
||||
hashCode = hashCode * 59 + Breed.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(DogAllOf left, DogAllOf right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(DogAllOf left, DogAllOf right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// An order for a pets from the pet store
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Order : IEquatable<Order>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PetId
|
||||
/// </summary>
|
||||
[DataMember(Name="petId", EmitDefaultValue=true)]
|
||||
public long PetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quantity
|
||||
/// </summary>
|
||||
[DataMember(Name="quantity", EmitDefaultValue=true)]
|
||||
public int Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShipDate
|
||||
/// </summary>
|
||||
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
||||
public DateTime ShipDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Order Status
|
||||
/// </summary>
|
||||
/// <value>Order Status</value>
|
||||
|
||||
public enum StatusEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum PlacedEnum for placed
|
||||
/// </summary>
|
||||
[EnumMember(Value = "placed")]
|
||||
PlacedEnum = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Enum ApprovedEnum for approved
|
||||
/// </summary>
|
||||
[EnumMember(Value = "approved")]
|
||||
ApprovedEnum = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Enum DeliveredEnum for delivered
|
||||
/// </summary>
|
||||
[EnumMember(Value = "delivered")]
|
||||
DeliveredEnum = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Order Status
|
||||
/// </summary>
|
||||
/// <value>Order Status</value>
|
||||
[DataMember(Name="status", EmitDefaultValue=true)]
|
||||
public StatusEnum Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Complete
|
||||
/// </summary>
|
||||
[DataMember(Name="complete", EmitDefaultValue=true)]
|
||||
public bool Complete { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Order {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Order)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Order instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Order to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Order other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Id == other.Id ||
|
||||
|
||||
Id.Equals(other.Id)
|
||||
) &&
|
||||
(
|
||||
PetId == other.PetId ||
|
||||
|
||||
PetId.Equals(other.PetId)
|
||||
) &&
|
||||
(
|
||||
Quantity == other.Quantity ||
|
||||
|
||||
Quantity.Equals(other.Quantity)
|
||||
) &&
|
||||
(
|
||||
ShipDate == other.ShipDate ||
|
||||
ShipDate != null &&
|
||||
ShipDate.Equals(other.ShipDate)
|
||||
) &&
|
||||
(
|
||||
Status == other.Status ||
|
||||
|
||||
Status.Equals(other.Status)
|
||||
) &&
|
||||
(
|
||||
Complete == other.Complete ||
|
||||
|
||||
Complete.Equals(other.Complete)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||
|
||||
hashCode = hashCode * 59 + PetId.GetHashCode();
|
||||
|
||||
hashCode = hashCode * 59 + Quantity.GetHashCode();
|
||||
if (ShipDate != null)
|
||||
hashCode = hashCode * 59 + ShipDate.GetHashCode();
|
||||
|
||||
hashCode = hashCode * 59 + Status.GetHashCode();
|
||||
|
||||
hashCode = hashCode * 59 + Complete.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Order left, Order right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Order left, Order right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A pet for sale in the pet store
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Pet : IEquatable<Pet>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Category
|
||||
/// </summary>
|
||||
[DataMember(Name="category", EmitDefaultValue=false)]
|
||||
public Category Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
/// <example>"doggie"</example>
|
||||
[Required]
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PhotoUrls
|
||||
/// </summary>
|
||||
[Required]
|
||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||
public List<string> PhotoUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Tags
|
||||
/// </summary>
|
||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||
public List<Tag> Tags { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// pet status in the store
|
||||
/// </summary>
|
||||
/// <value>pet status in the store</value>
|
||||
|
||||
public enum StatusEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum AvailableEnum for available
|
||||
/// </summary>
|
||||
[EnumMember(Value = "available")]
|
||||
AvailableEnum = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Enum PendingEnum for pending
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
PendingEnum = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Enum SoldEnum for sold
|
||||
/// </summary>
|
||||
[EnumMember(Value = "sold")]
|
||||
SoldEnum = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// pet status in the store
|
||||
/// </summary>
|
||||
/// <value>pet status in the store</value>
|
||||
[DataMember(Name="status", EmitDefaultValue=true)]
|
||||
public StatusEnum Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Pet {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Pet)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Pet instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Pet to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Pet other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Id == other.Id ||
|
||||
|
||||
Id.Equals(other.Id)
|
||||
) &&
|
||||
(
|
||||
Category == other.Category ||
|
||||
Category != null &&
|
||||
Category.Equals(other.Category)
|
||||
) &&
|
||||
(
|
||||
Name == other.Name ||
|
||||
Name != null &&
|
||||
Name.Equals(other.Name)
|
||||
) &&
|
||||
(
|
||||
PhotoUrls == other.PhotoUrls ||
|
||||
PhotoUrls != null &&
|
||||
other.PhotoUrls != null &&
|
||||
PhotoUrls.SequenceEqual(other.PhotoUrls)
|
||||
) &&
|
||||
(
|
||||
Tags == other.Tags ||
|
||||
Tags != null &&
|
||||
other.Tags != null &&
|
||||
Tags.SequenceEqual(other.Tags)
|
||||
) &&
|
||||
(
|
||||
Status == other.Status ||
|
||||
|
||||
Status.Equals(other.Status)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||
if (Category != null)
|
||||
hashCode = hashCode * 59 + Category.GetHashCode();
|
||||
if (Name != null)
|
||||
hashCode = hashCode * 59 + Name.GetHashCode();
|
||||
if (PhotoUrls != null)
|
||||
hashCode = hashCode * 59 + PhotoUrls.GetHashCode();
|
||||
if (Tags != null)
|
||||
hashCode = hashCode * 59 + Tags.GetHashCode();
|
||||
|
||||
hashCode = hashCode * 59 + Status.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Pet left, Pet right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Pet left, Pet right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A tag for a pet
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Tag : IEquatable<Tag>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Tag {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((Tag)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if Tag instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of Tag to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(Tag other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Id == other.Id ||
|
||||
|
||||
Id.Equals(other.Id)
|
||||
) &&
|
||||
(
|
||||
Name == other.Name ||
|
||||
Name != null &&
|
||||
Name.Equals(other.Name)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||
if (Name != null)
|
||||
hashCode = hashCode * 59 + Name.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(Tag left, Tag right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Tag left, Tag right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using Org.OpenAPITools.Converters;
|
||||
|
||||
namespace Org.OpenAPITools.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A User who is purchasing from the pet store
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class User : IEquatable<User>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Username
|
||||
/// </summary>
|
||||
[DataMember(Name="username", EmitDefaultValue=false)]
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets FirstName
|
||||
/// </summary>
|
||||
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets LastName
|
||||
/// </summary>
|
||||
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Email
|
||||
/// </summary>
|
||||
[DataMember(Name="email", EmitDefaultValue=false)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Password
|
||||
/// </summary>
|
||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Phone
|
||||
/// </summary>
|
||||
[DataMember(Name="phone", EmitDefaultValue=false)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Status
|
||||
/// </summary>
|
||||
/// <value>User Status</value>
|
||||
[DataMember(Name="userStatus", EmitDefaultValue=true)]
|
||||
public int UserStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class User {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals((User)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if User instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of User to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(User other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return
|
||||
(
|
||||
Id == other.Id ||
|
||||
|
||||
Id.Equals(other.Id)
|
||||
) &&
|
||||
(
|
||||
Username == other.Username ||
|
||||
Username != null &&
|
||||
Username.Equals(other.Username)
|
||||
) &&
|
||||
(
|
||||
FirstName == other.FirstName ||
|
||||
FirstName != null &&
|
||||
FirstName.Equals(other.FirstName)
|
||||
) &&
|
||||
(
|
||||
LastName == other.LastName ||
|
||||
LastName != null &&
|
||||
LastName.Equals(other.LastName)
|
||||
) &&
|
||||
(
|
||||
Email == other.Email ||
|
||||
Email != null &&
|
||||
Email.Equals(other.Email)
|
||||
) &&
|
||||
(
|
||||
Password == other.Password ||
|
||||
Password != null &&
|
||||
Password.Equals(other.Password)
|
||||
) &&
|
||||
(
|
||||
Phone == other.Phone ||
|
||||
Phone != null &&
|
||||
Phone.Equals(other.Phone)
|
||||
) &&
|
||||
(
|
||||
UserStatus == other.UserStatus ||
|
||||
|
||||
UserStatus.Equals(other.UserStatus)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
hashCode = hashCode * 59 + Id.GetHashCode();
|
||||
if (Username != null)
|
||||
hashCode = hashCode * 59 + Username.GetHashCode();
|
||||
if (FirstName != null)
|
||||
hashCode = hashCode * 59 + FirstName.GetHashCode();
|
||||
if (LastName != null)
|
||||
hashCode = hashCode * 59 + LastName.GetHashCode();
|
||||
if (Email != null)
|
||||
hashCode = hashCode * 59 + Email.GetHashCode();
|
||||
if (Password != null)
|
||||
hashCode = hashCode * 59 + Password.GetHashCode();
|
||||
if (Phone != null)
|
||||
hashCode = hashCode * 59 + Phone.GetHashCode();
|
||||
|
||||
hashCode = hashCode * 59 + UserStatus.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==(User left, User right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(User left, User right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Org.OpenAPITools.OpenApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Replacement utilities from Swashbuckle.AspNetCore.SwaggerGen which are not in 5.x
|
||||
/// </summary>
|
||||
public static class TypeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Produce a friendly name for the type which is unique.
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="fullyQualified"></param>
|
||||
public static string FriendlyId(this Type type, bool fullyQualified = false)
|
||||
{
|
||||
var typeName = fullyQualified
|
||||
? type.FullNameSansTypeParameters().Replace("+", ".")
|
||||
: type.Name;
|
||||
|
||||
if (type.IsGenericType)
|
||||
{
|
||||
var genericArgumentIds = type.GetGenericArguments()
|
||||
.Select(t => t.FriendlyId(fullyQualified))
|
||||
.ToArray();
|
||||
|
||||
return new StringBuilder(typeName)
|
||||
.Replace($"`{genericArgumentIds.Count()}", string.Empty)
|
||||
.Append($"[{string.Join(",", genericArgumentIds).TrimEnd(',')}]")
|
||||
.ToString();
|
||||
}
|
||||
|
||||
return typeName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the fully qualified type name without type parameters.
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
public static string FullNameSansTypeParameters(this Type type)
|
||||
{
|
||||
var fullName = type.FullName;
|
||||
if (string.IsNullOrEmpty(fullName))
|
||||
fullName = type.Name;
|
||||
var chopIndex = fullName.IndexOf("[[", StringComparison.Ordinal);
|
||||
return (chopIndex == -1) ? fullName : fullName.Substring(0, chopIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<Description>A library generated from a OpenAPI doc</Description>
|
||||
<Copyright>No Copyright</Copyright>
|
||||
<Authors>OpenAPI</Authors>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<Version>1.0.0</Version>
|
||||
<AssemblyName>Org.OpenAPITools</AssemblyName>
|
||||
<PackageId>Org.OpenAPITools</PackageId>
|
||||
<UserSecretsId>cb87e868-8646-48ef-9bb6-344b537d0d37</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.4.0" />
|
||||
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />-->
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Org.OpenAPITools
|
||||
{
|
||||
/// <summary>
|
||||
/// Program
|
||||
/// </summary>
|
||||
public class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Main
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the host builder.
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns>IHostBuilder</returns>
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>()
|
||||
.UseUrls("http://0.0.0.0:8080/");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:61788",
|
||||
"sslPort": 44301
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "openapi",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"OpenAPI": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "openapi",
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/openapi",
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Org.OpenAPITools.Authentication;
|
||||
using Org.OpenAPITools.Filters;
|
||||
using Org.OpenAPITools.OpenApi;
|
||||
using Org.OpenAPITools.Formatters;
|
||||
|
||||
namespace Org.OpenAPITools
|
||||
{
|
||||
/// <summary>
|
||||
/// Startup
|
||||
/// </summary>
|
||||
public class Startup
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The application configuration.
|
||||
/// </summary>
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This method gets called by the runtime. Use this method to add services to the container.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<IAuthorizationHandler, ApiKeyRequirementHandler>();
|
||||
services.AddAuthorization(authConfig =>
|
||||
{
|
||||
authConfig.AddPolicy("api_key", policyBuilder =>
|
||||
{
|
||||
policyBuilder
|
||||
.AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"api_key"));
|
||||
});
|
||||
});
|
||||
|
||||
// Add framework services.
|
||||
services
|
||||
// Don't need the full MVC stack for an API, see https://andrewlock.net/comparing-startup-between-the-asp-net-core-3-templates/
|
||||
.AddControllers(options => {
|
||||
options.InputFormatters.Insert(0, new InputFormatterStream());
|
||||
})
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
|
||||
});
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true);
|
||||
|
||||
c.SwaggerDoc("1.0.0", new OpenApiInfo
|
||||
{
|
||||
Title = "OpenAPI Petstore",
|
||||
Description = "OpenAPI Petstore (ASP.NET Core 6.0)",
|
||||
TermsOfService = new Uri("https://github.com/openapitools/openapi-generator"),
|
||||
Contact = new OpenApiContact
|
||||
{
|
||||
Name = "OpenAPI-Generator Contributors",
|
||||
Url = new Uri("https://github.com/openapitools/openapi-generator"),
|
||||
Email = ""
|
||||
},
|
||||
License = new OpenApiLicense
|
||||
{
|
||||
Name = "NoLicense",
|
||||
Url = new Uri("https://www.apache.org/licenses/LICENSE-2.0.html")
|
||||
},
|
||||
Version = "1.0.0",
|
||||
});
|
||||
c.CustomSchemaIds(type => type.FriendlyId(true));
|
||||
c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml");
|
||||
// Sets the basePath property in the OpenAPI document generated
|
||||
c.DocumentFilter<BasePathFilter>("/v2");
|
||||
|
||||
// Include DataAnnotation attributes on Controller Action parameters as OpenAPI validation rules (e.g required, pattern, ..)
|
||||
// Use [ValidateModelState] on Actions to actually validate it in C# as well!
|
||||
c.OperationFilter<GeneratePathParamsValidationFilter>();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="env"></param>
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.RouteTemplate = "openapi/{documentName}/openapi.json";
|
||||
})
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
// set route prefix to openapi, e.g. http://localhost:8080/openapi/index.html
|
||||
c.RoutePrefix = "openapi";
|
||||
//TODO: Either use the SwaggerGen generated OpenAPI contract (generated from C# classes)
|
||||
c.SwaggerEndpoint("/openapi/1.0.0/openapi.json", "OpenAPI Petstore");
|
||||
|
||||
//TODO: Or alternatively use the original OpenAPI contract that's included in the static files
|
||||
// c.SwaggerEndpoint("/openapi-original.json", "OpenAPI Petstore Original");
|
||||
});
|
||||
app.UseRouting();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
# Welcome to ASP.NET 5 Preview
|
||||
|
||||
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
|
||||
|
||||
ASP.NET 5 has been rearchitected to make it **lean** and **composable**. It's fully **open source** and available on [GitHub](http://go.microsoft.com/fwlink/?LinkID=517854).
|
||||
Your new project automatically takes advantage of modern client-side utilities like [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) and [npm](http://go.microsoft.com/fwlink/?LinkId=518005) (to add client-side libraries) and [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) (for client-side build and automation tasks).
|
||||
|
||||
We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015.
|
||||
The ASP.NET Team
|
||||
|
||||
### You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016)
|
||||
|
||||
### This application consists of:
|
||||
* Sample pages using ASP.NET MVC 6
|
||||
* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side resources
|
||||
* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939)
|
||||
|
||||
#### NEW CONCEPTS
|
||||
* [The 'wwwroot' explained](http://go.microsoft.com/fwlink/?LinkId=518008)
|
||||
* [Configuration in ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518012)
|
||||
* [Dependency Injection](http://go.microsoft.com/fwlink/?LinkId=518013)
|
||||
* [Razor TagHelpers](http://go.microsoft.com/fwlink/?LinkId=518014)
|
||||
* [Manage client packages using Gulp](http://go.microsoft.com/fwlink/?LinkID=517849)
|
||||
* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=517850)
|
||||
|
||||
#### CUSTOMIZE APP
|
||||
* [Add Controllers and Views](http://go.microsoft.com/fwlink/?LinkID=398600)
|
||||
* [Add Data using EntityFramework](http://go.microsoft.com/fwlink/?LinkID=398602)
|
||||
* [Add Authentication using Identity](http://go.microsoft.com/fwlink/?LinkID=398603)
|
||||
* [Add real time support using SignalR](http://go.microsoft.com/fwlink/?LinkID=398606)
|
||||
* [Add Class library](http://go.microsoft.com/fwlink/?LinkID=398604)
|
||||
* [Add Web APIs with MVC 6](http://go.microsoft.com/fwlink/?LinkId=518009)
|
||||
* [Add client packages using Bower](http://go.microsoft.com/fwlink/?LinkID=517848)
|
||||
|
||||
#### DEPLOY
|
||||
* [Run your app locally](http://go.microsoft.com/fwlink/?LinkID=517851)
|
||||
* [Run your app on ASP.NET Core 5](http://go.microsoft.com/fwlink/?LinkID=517852)
|
||||
* [Run commands in your 'project.json'](http://go.microsoft.com/fwlink/?LinkID=517853)
|
||||
* [Publish to Microsoft Azure Web Sites](http://go.microsoft.com/fwlink/?LinkID=398609)
|
||||
* [Publish to the file system](http://go.microsoft.com/fwlink/?LinkId=518019)
|
||||
|
||||
We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015)
|
||||
@@ -0,0 +1 @@
|
||||
<meta http-equiv="refresh" content="0;URL='./openapi/'" />
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user