From cc1226c0db8d85e66b609c6e3501574ddcb69ef3 Mon Sep 17 00:00:00 2001 From: devhl-labs Date: Tue, 16 May 2023 02:05:17 -0400 Subject: [PATCH] [csharp-netcore] Zero based inner enum sample (#15506) * added to the sample * build samples again --- ...odels-for-testing-with-http-signature.yaml | 8 + .../.openapi-generator/FILES | 2 + .../README.md | 1 + .../api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 173 ++++++++++++++ .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 8 + .../docs/models/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 68 ++++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../Client/HostConfiguration.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 214 ++++++++++++++++++ .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 8 + .../docs/models/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 68 ++++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../Client/HostConfiguration.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 212 +++++++++++++++++ .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 8 + .../docs/models/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 68 ++++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../Client/HostConfiguration.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 212 +++++++++++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-httpclient/README.md | 1 + .../OpenAPIClient-httpclient/api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 150 ++++++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-net47/README.md | 1 + .../OpenAPIClient-net47/api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 149 ++++++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-net48/README.md | 1 + .../OpenAPIClient-net48/api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 149 ++++++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-net5.0/README.md | 1 + .../OpenAPIClient-net5.0/api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 149 ++++++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-unityWebRequest/README.md | 1 + .../api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 66 ++++++ .../Model/ZeroBasedEnumClass.cs | 134 +++++++++++ .../OpenAPIClient/.openapi-generator/FILES | 2 + .../csharp-netcore/OpenAPIClient/README.md | 1 + .../OpenAPIClient/api/openapi.yaml | 8 + .../OpenAPIClient/docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 149 ++++++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClientCore/README.md | 1 + .../OpenAPIClientCore/api/openapi.yaml | 8 + .../docs/ZeroBasedEnumClass.md | 10 + .../Model/ZeroBasedEnumClassTests.cs | 69 ++++++ .../Model/ZeroBasedEnumClass.cs | 137 +++++++++++ 70 files changed, 2826 insertions(+) create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ZeroBasedEnumClass.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index a8b17d4ee29..ef87ff72dc3 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -2284,3 +2284,11 @@ components: enum: - unknown - notUnknown + ZeroBasedEnumClass: + type: object + properties: + ZeroBasedEnum: + type: string + enum: + - unknown + - notUnknown \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES index 376ab9059fd..53972796813 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -212,4 +213,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md index 2f0cbab8347..23ba947f366 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md @@ -235,6 +235,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..8c1905c7d42 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,173 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum + { + get{ return _ZeroBasedEnum;} + set + { + _ZeroBasedEnum = value; + _flagZeroBasedEnum = true; + } + } + private ZeroBasedEnumEnum? _ZeroBasedEnum; + private bool _flagZeroBasedEnum; + + /// + /// Returns false as ZeroBasedEnum should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeZeroBasedEnum() + { + return _flagZeroBasedEnum; + } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this._ZeroBasedEnum = zeroBasedEnum; + if (this.ZeroBasedEnum != null) + { + this._flagZeroBasedEnum = true; + } + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES index f157ccfab07..d1fbcff0c4b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/models/User.md docs/models/Whale.md docs/models/Zebra.md docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -218,5 +219,6 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..614d00cbe87 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..7b8d0f1acdf --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs index 613a6a459eb..bd413665655 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -166,6 +166,8 @@ namespace Org.OpenAPITools.Client return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) return ZeroBasedEnumConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnumClassZeroBasedEnumEnum) + return ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClassZeroBasedEnumEnum); if (obj is ICollection collection) { List entries = new List(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5b9a00eb014..6253cc861be 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -139,6 +139,7 @@ namespace Org.OpenAPITools.Client _jsonOptions.Converters.Add(new ZebraJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumNullableConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); _services.AddSingleton(new JsonSerializerOptionsProvider(_jsonOptions)); _services.AddSingleton(); _services.AddTransient(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..8fe6e16d660 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,214 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + { + ZeroBasedEnum = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + + } + + /// + /// Returns a ZeroBasedEnumEnum + /// + /// + /// + public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) + { + if (value == "unknown") + return ZeroBasedEnumEnum.Unknown; + + if (value == "notUnknown") + return ZeroBasedEnumEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumEnum: '{value}'"); + } + + /// + /// Returns equivalent json value + /// + /// + /// + /// + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + { + if (value == ZeroBasedEnumEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type ZeroBasedEnumClass + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// A Json reader. + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? propertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (propertyName) + { + case "ZeroBasedEnum": + string zeroBasedEnumRawValue = utf8JsonReader.GetString(); + zeroBasedEnum = ZeroBasedEnumClass.ZeroBasedEnumEnumFromString(zeroBasedEnumRawValue); + break; + default: + break; + } + } + } + +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// A Json writer + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + if (zeroBasedEnumRawValue != null) + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + else + writer.WriteNull("ZeroBasedEnum"); + + writer.WriteEndObject(); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index f157ccfab07..d1fbcff0c4b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/models/User.md docs/models/Whale.md docs/models/Zebra.md docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -218,5 +219,6 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..614d00cbe87 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..7b8d0f1acdf --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs index a3c368e1863..6083ce6a811 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -164,6 +164,8 @@ namespace Org.OpenAPITools.Client return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) return ZeroBasedEnumConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnumClassZeroBasedEnumEnum) + return ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClassZeroBasedEnumEnum); if (obj is ICollection collection) { List entries = new List(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 146043fa851..a3771b4fe46 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -137,6 +137,7 @@ namespace Org.OpenAPITools.Client _jsonOptions.Converters.Add(new ZebraJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumNullableConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); _services.AddSingleton(new JsonSerializerOptionsProvider(_jsonOptions)); _services.AddSingleton(); _services.AddTransient(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..27d86507f62 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,212 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + { + ZeroBasedEnum = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + + } + + /// + /// Returns a ZeroBasedEnumEnum + /// + /// + /// + public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) + { + if (value == "unknown") + return ZeroBasedEnumEnum.Unknown; + + if (value == "notUnknown") + return ZeroBasedEnumEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumEnum: '{value}'"); + } + + /// + /// Returns equivalent json value + /// + /// + /// + /// + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + { + if (value == ZeroBasedEnumEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type ZeroBasedEnumClass + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// A Json reader. + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string propertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (propertyName) + { + case "ZeroBasedEnum": + string zeroBasedEnumRawValue = utf8JsonReader.GetString(); + zeroBasedEnum = ZeroBasedEnumClass.ZeroBasedEnumEnumFromString(zeroBasedEnumRawValue); + break; + default: + break; + } + } + } + +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// A Json writer + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + if (zeroBasedEnumRawValue != null) + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + else + writer.WriteNull("ZeroBasedEnum"); + + writer.WriteEndObject(); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index f157ccfab07..d1fbcff0c4b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/models/User.md docs/models/Whale.md docs/models/Zebra.md docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -218,5 +219,6 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..614d00cbe87 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..7b8d0f1acdf --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs index 816e56aabcb..2b5879e4be2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -164,6 +164,8 @@ namespace Org.OpenAPITools.Client return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) return ZeroBasedEnumConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnumClassZeroBasedEnumEnum) + return ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClassZeroBasedEnumEnum); if (obj is ICollection collection) { List entries = new List(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 146043fa851..a3771b4fe46 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -137,6 +137,7 @@ namespace Org.OpenAPITools.Client _jsonOptions.Converters.Add(new ZebraJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumNullableConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); _services.AddSingleton(new JsonSerializerOptionsProvider(_jsonOptions)); _services.AddSingleton(); _services.AddTransient(); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..27d86507f62 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,212 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + { + ZeroBasedEnum = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + + } + + /// + /// Returns a ZeroBasedEnumEnum + /// + /// + /// + public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) + { + if (value == "unknown") + return ZeroBasedEnumEnum.Unknown; + + if (value == "notUnknown") + return ZeroBasedEnumEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumEnum: '{value}'"); + } + + /// + /// Returns equivalent json value + /// + /// + /// + /// + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + { + if (value == ZeroBasedEnumEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type ZeroBasedEnumClass + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// A Json reader. + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string propertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (propertyName) + { + case "ZeroBasedEnum": + string zeroBasedEnumRawValue = utf8JsonReader.GetString(); + zeroBasedEnum = ZeroBasedEnumClass.ZeroBasedEnumEnumFromString(zeroBasedEnumRawValue); + break; + default: + break; + } + } + } + +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' +#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// A Json writer + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + if (zeroBasedEnumRawValue != null) + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + else + writer.WriteNull("ZeroBasedEnum"); + + writer.WriteEndObject(); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES index e5a0b20ddd3..ca215d49250 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools/Api/AnotherFakeApi.cs src/Org.OpenAPITools/Api/DefaultApi.cs @@ -209,4 +210,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md index 7d96ef45209..32196c1e971 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md @@ -260,6 +260,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..f787446efca --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Org.OpenAPITools.Client.FileParameter; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES index 376ab9059fd..53972796813 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -212,4 +213,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md index d6f1f69f5c8..59f6637d46f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md @@ -247,6 +247,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..33f1c843bc3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES index 376ab9059fd..53972796813 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -212,4 +213,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md index d6f1f69f5c8..59f6637d46f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md @@ -247,6 +247,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..33f1c843bc3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES index 376ab9059fd..53972796813 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -212,4 +213,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md index d6f1f69f5c8..59f6637d46f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md @@ -247,6 +247,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..33f1c843bc3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES index ccb95e09bcc..3a1325c51b9 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/.openapi-generator/FILES @@ -94,6 +94,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.asmdef src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -208,4 +209,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.asmdef diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md index d4c1559040d..694e663a956 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/README.md @@ -221,6 +221,7 @@ Class | Method | HTTP request | Description - [Model.Whale](Whale.md) - [Model.Zebra](Zebra.md) - [Model.ZeroBasedEnum](ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..c7d1f20b834 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; +using NUnit.Framework; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Test] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Test] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..9301b997585 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,134 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ZeroBasedEnumClass); + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + if (input == null) + { + return false; + } + return + ( + this.ZeroBasedEnum == input.ZeroBasedEnum || + this.ZeroBasedEnum.Equals(input.ZeroBasedEnum) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES index 6dab01063ea..033abe3804a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools/Api/AnotherFakeApi.cs src/Org.OpenAPITools/Api/DefaultApi.cs @@ -211,4 +212,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md index 2f0cbab8347..23ba947f366 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md @@ -235,6 +235,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..33f1c843bc3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES index 6dab01063ea..033abe3804a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/UserApi.md docs/Whale.md docs/Zebra.md docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md git_push.sh src/Org.OpenAPITools/Api/AnotherFakeApi.cs src/Org.OpenAPITools/Api/DefaultApi.cs @@ -211,4 +212,5 @@ src/Org.OpenAPITools/Model/User.cs src/Org.OpenAPITools/Model/Whale.cs src/Org.OpenAPITools/Model/Zebra.cs src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md index d6f1f69f5c8..59f6637d46f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md @@ -247,6 +247,7 @@ Class | Method | HTTP request | Description - [Model.Whale](docs/Whale.md) - [Model.Zebra](docs/Zebra.md) - [Model.ZeroBasedEnum](docs/ZeroBasedEnum.md) + - [Model.ZeroBasedEnumClass](docs/ZeroBasedEnumClass.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml index d1ab69d2975..22e8da5234e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml @@ -2211,6 +2211,14 @@ components: - unknown - notUnknown type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ZeroBasedEnumClass.md new file mode 100644 index 00000000000..b804bc0d7fb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 00000000000..f713baf3235 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 00000000000..3b093b8b616 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,137 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + [DataContract(Name = "ZeroBasedEnumClass")] + public partial class ZeroBasedEnumClass : IEquatable, IValidatableObject + { + /// + /// Defines ZeroBasedEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + [EnumMember(Value = "unknown")] + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + [EnumMember(Value = "notUnknown")] + NotUnknown + + } + + + /// + /// Gets or Sets ZeroBasedEnum + /// + [DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)] + public ZeroBasedEnumEnum? ZeroBasedEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum. + public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?)) + { + this.ZeroBasedEnum = zeroBasedEnum; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual; + } + + /// + /// Returns true if ZeroBasedEnumClass instances are equal + /// + /// Instance of ZeroBasedEnumClass to be compared + /// Boolean + public bool Equals(ZeroBasedEnumClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ZeroBasedEnum.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +}