[csharp] Refactor anyOf model template (#18901)

* Refactor AnyOf model removed "this."

* Updated csharp samples
This commit is contained in:
Filipe Silva
2024-06-11 11:43:27 +01:00
committed by GitHub
parent 8357cc313b
commit 7f34e11a7f
17 changed files with 361 additions and 361 deletions

View File

@@ -41,9 +41,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of Apple.</param>
public GmFruit(Apple actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
/// <summary>
@@ -53,9 +53,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of Banana.</param>
public GmFruit(Banana actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
@@ -74,11 +74,11 @@ namespace Org.OpenAPITools.Model
{
if (value.GetType() == typeof(Apple))
{
this._actualInstance = value;
_actualInstance = value;
}
else if (value.GetType() == typeof(Banana))
{
this._actualInstance = value;
_actualInstance = value;
}
else
{
@@ -94,7 +94,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of Apple</returns>
public Apple GetApple()
{
return (Apple)this.ActualInstance;
return (Apple)ActualInstance;
}
/// <summary>
@@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of Banana</returns>
public Banana GetBanana()
{
return (Banana)this.ActualInstance;
return (Banana)ActualInstance;
}
/// <summary>
@@ -115,7 +115,7 @@ namespace Org.OpenAPITools.Model
{
var sb = new StringBuilder();
sb.Append("class GmFruit {\n");
sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n");
sb.Append(" ActualInstance: ").Append(ActualInstance).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@@ -126,7 +126,7 @@ namespace Org.OpenAPITools.Model
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return JsonConvert.SerializeObject(this.ActualInstance, GmFruit.SerializerSettings);
return JsonConvert.SerializeObject(ActualInstance, GmFruit.SerializerSettings);
}
/// <summary>
@@ -200,8 +200,8 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.ActualInstance != null)
hashCode = hashCode * 59 + this.ActualInstance.GetHashCode();
if (ActualInstance != null)
hashCode = hashCode * 59 + ActualInstance.GetHashCode();
return hashCode;
}
}

View File

@@ -41,9 +41,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of string.</param>
public MixedAnyOfContent(string actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
/// <summary>
@@ -53,9 +53,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of bool.</param>
public MixedAnyOfContent(bool actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance;
}
/// <summary>
@@ -65,9 +65,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of int.</param>
public MixedAnyOfContent(int actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance;
}
/// <summary>
@@ -77,9 +77,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of decimal.</param>
public MixedAnyOfContent(decimal actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance;
}
/// <summary>
@@ -89,9 +89,9 @@ namespace Org.OpenAPITools.Model
/// <param name="actualInstance">An instance of MixedSubId.</param>
public MixedAnyOfContent(MixedSubId actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
IsNullable = false;
SchemaType= "anyOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
@@ -110,23 +110,23 @@ namespace Org.OpenAPITools.Model
{
if (value.GetType() == typeof(MixedSubId))
{
this._actualInstance = value;
_actualInstance = value;
}
else if (value.GetType() == typeof(bool))
{
this._actualInstance = value;
_actualInstance = value;
}
else if (value.GetType() == typeof(decimal))
{
this._actualInstance = value;
_actualInstance = value;
}
else if (value.GetType() == typeof(int))
{
this._actualInstance = value;
_actualInstance = value;
}
else if (value.GetType() == typeof(string))
{
this._actualInstance = value;
_actualInstance = value;
}
else
{
@@ -142,7 +142,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of string</returns>
public string GetString()
{
return (string)this.ActualInstance;
return (string)ActualInstance;
}
/// <summary>
@@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of bool</returns>
public bool GetBool()
{
return (bool)this.ActualInstance;
return (bool)ActualInstance;
}
/// <summary>
@@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of int</returns>
public int GetInt()
{
return (int)this.ActualInstance;
return (int)ActualInstance;
}
/// <summary>
@@ -172,7 +172,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of decimal</returns>
public decimal GetDecimal()
{
return (decimal)this.ActualInstance;
return (decimal)ActualInstance;
}
/// <summary>
@@ -182,7 +182,7 @@ namespace Org.OpenAPITools.Model
/// <returns>An instance of MixedSubId</returns>
public MixedSubId GetMixedSubId()
{
return (MixedSubId)this.ActualInstance;
return (MixedSubId)ActualInstance;
}
/// <summary>
@@ -193,7 +193,7 @@ namespace Org.OpenAPITools.Model
{
var sb = new StringBuilder();
sb.Append("class MixedAnyOfContent {\n");
sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n");
sb.Append(" ActualInstance: ").Append(ActualInstance).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@@ -204,7 +204,7 @@ namespace Org.OpenAPITools.Model
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return JsonConvert.SerializeObject(this.ActualInstance, MixedAnyOfContent.SerializerSettings);
return JsonConvert.SerializeObject(ActualInstance, MixedAnyOfContent.SerializerSettings);
}
/// <summary>
@@ -314,8 +314,8 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.ActualInstance != null)
hashCode = hashCode * 59 + this.ActualInstance.GetHashCode();
if (ActualInstance != null)
hashCode = hashCode * 59 + ActualInstance.GetHashCode();
return hashCode;
}
}