Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[csharp-netcore] Zero based inner enum sample #15506

Merged
merged 2 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2284,3 +2284,11 @@ components:
enum:
- unknown
- notUnknown
ZeroBasedEnumClass:
type: object
properties:
ZeroBasedEnum:
type: string
enum:
- unknown
- notUnknown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)


<a id="documentation-for-authorization"></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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)

Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Class for testing ZeroBasedEnumClass
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
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.
}

/// <summary>
/// Test an instance of ZeroBasedEnumClass
/// </summary>
[Fact]
public void ZeroBasedEnumClassInstanceTest()
{
// TODO uncomment below to test "IsType" ZeroBasedEnumClass
//Assert.IsType<ZeroBasedEnumClass>(instance);
}


/// <summary>
/// Test the property 'ZeroBasedEnum'
/// </summary>
[Fact]
public void ZeroBasedEnumTest()
{
// TODO unit test for the property 'ZeroBasedEnum'
}

}

}
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// ZeroBasedEnumClass
/// </summary>
[DataContract(Name = "ZeroBasedEnumClass")]
public partial class ZeroBasedEnumClass : IEquatable<ZeroBasedEnumClass>, IValidatableObject
{
/// <summary>
/// Defines ZeroBasedEnum
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ZeroBasedEnumEnum
{
/// <summary>
/// Enum Unknown for value: unknown
/// </summary>
[EnumMember(Value = "unknown")]
Unknown,

/// <summary>
/// Enum NotUnknown for value: notUnknown
/// </summary>
[EnumMember(Value = "notUnknown")]
NotUnknown

}


/// <summary>
/// Gets or Sets ZeroBasedEnum
/// </summary>

[DataMember(Name = "ZeroBasedEnum", EmitDefaultValue = false)]
public ZeroBasedEnumEnum? ZeroBasedEnum
{
get{ return _ZeroBasedEnum;}
set
{
_ZeroBasedEnum = value;
_flagZeroBasedEnum = true;
}
}
private ZeroBasedEnumEnum? _ZeroBasedEnum;
private bool _flagZeroBasedEnum;

/// <summary>
/// Returns false as ZeroBasedEnum should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeZeroBasedEnum()
{
return _flagZeroBasedEnum;
}
/// <summary>
/// Initializes a new instance of the <see cref="ZeroBasedEnumClass" /> class.
/// </summary>
/// <param name="zeroBasedEnum">zeroBasedEnum.</param>
public ZeroBasedEnumClass(ZeroBasedEnumEnum? zeroBasedEnum = default(ZeroBasedEnumEnum?))
{
this._ZeroBasedEnum = zeroBasedEnum;
if (this.ZeroBasedEnum != null)
{
this._flagZeroBasedEnum = true;
}
this.AdditionalProperties = new Dictionary<string, object>();
}

/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
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();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ZeroBasedEnumClass).AreEqual;
}

/// <summary>
/// Returns true if ZeroBasedEnumClass instances are equal
/// </summary>
/// <param name="input">Instance of ZeroBasedEnumClass to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ZeroBasedEnumClass input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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;
}
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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)

Loading