Skip to content

Commit 20ff08b

Browse files
committed
Update samples
1 parent b9127b7 commit 20ff08b

16 files changed

Lines changed: 229 additions & 229 deletions

File tree

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Model/AreaCode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ public override AreaCode Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv
151151
}
152152

153153
if (stateTerritoryCode != null)
154-
return new AreaCode(stateTerritoryCode.Value);
154+
return new AreaCode(stateTerritoryCode);
155155

156156
if (marineAreaCode != null)
157-
return new AreaCode(marineAreaCode.Value);
157+
return new AreaCode(marineAreaCode);
158158

159159
throw new JsonException();
160160
}

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Model/MarineAreaCode.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public override MarineAreaCode Read(ref Utf8JsonReader reader, Type typeToConver
131131
/// <param name="options"></param>
132132
public override void Write(Utf8JsonWriter writer, MarineAreaCode marineAreaCode, JsonSerializerOptions options)
133133
{
134-
writer.WriteStringValue(marineAreaCode.ToString());
134+
writer.WriteStringValue(MarineAreaCodeValueConverter.ToJsonValue(marineAreaCode).ToString());
135135
}
136136
}
137137

@@ -162,14 +162,14 @@ public class MarineAreaCodeNullableJsonConverter : JsonConverter<MarineAreaCode?
162162
}
163163

164164
/// <summary>
165-
/// Writes the DateTime to the json writer
165+
/// Writes the MarineAreaCode to the json writer
166166
/// </summary>
167167
/// <param name="writer"></param>
168168
/// <param name="marineAreaCode"></param>
169169
/// <param name="options"></param>
170170
public override void Write(Utf8JsonWriter writer, MarineAreaCode? marineAreaCode, JsonSerializerOptions options)
171171
{
172-
writer.WriteStringValue(marineAreaCode?.ToString() ?? "null");
172+
writer.WriteStringValue(marineAreaCode.HasValue ? MarineAreaCodeValueConverter.ToJsonValue(marineAreaCode.Value).ToString() : "null");
173173
}
174174
}
175175
}

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Model/StateTerritoryCode.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public override StateTerritoryCode Read(ref Utf8JsonReader reader, Type typeToCo
131131
/// <param name="options"></param>
132132
public override void Write(Utf8JsonWriter writer, StateTerritoryCode stateTerritoryCode, JsonSerializerOptions options)
133133
{
134-
writer.WriteStringValue(stateTerritoryCode.ToString());
134+
writer.WriteStringValue(StateTerritoryCodeValueConverter.ToJsonValue(stateTerritoryCode).ToString());
135135
}
136136
}
137137

@@ -162,14 +162,14 @@ public class StateTerritoryCodeNullableJsonConverter : JsonConverter<StateTerrit
162162
}
163163

164164
/// <summary>
165-
/// Writes the DateTime to the json writer
165+
/// Writes the StateTerritoryCode to the json writer
166166
/// </summary>
167167
/// <param name="writer"></param>
168168
/// <param name="stateTerritoryCode"></param>
169169
/// <param name="options"></param>
170170
public override void Write(Utf8JsonWriter writer, StateTerritoryCode? stateTerritoryCode, JsonSerializerOptions options)
171171
{
172-
writer.WriteStringValue(stateTerritoryCode?.ToString() ?? "null");
172+
writer.WriteStringValue(stateTerritoryCode.HasValue ? StateTerritoryCodeValueConverter.ToJsonValue(stateTerritoryCode.Value).ToString() : "null");
173173
}
174174
}
175175
}

samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class FormatTest : IValidatableObject
4141
/// <param name="dateTime">dateTime</param>
4242
/// <param name="decimal">decimal</param>
4343
/// <param name="double">double</param>
44-
/// <param name="duplicatePropertyName2">duplicatePropertyName2</param>
44+
/// <param name="duplicatePropertyName">duplicatePropertyName</param>
4545
/// <param name="duplicatePropertyName">duplicatePropertyName</param>
4646
/// <param name="float">float</param>
4747
/// <param name="int32">int32</param>
@@ -61,7 +61,7 @@ public partial class FormatTest : IValidatableObject
6161
/// <param name="unsignedLong">unsignedLong</param>
6262
/// <param name="uuid">uuid</param>
6363
[JsonConstructor]
64-
public FormatTest(byte[] @byte, DateTime date, decimal number, string password, decimal stringFormattedAsDecimalRequired, Option<System.IO.Stream> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> @decimal = default, Option<double?> @double = default, Option<string> duplicatePropertyName2 = default, Option<string> duplicatePropertyName = default, Option<float?> @float = default, Option<int?> int32 = default, Option<int?> int32Range = default, Option<long?> int64 = default, Option<long?> int64Negative = default, Option<long?> int64NegativeExclusive = default, Option<long?> int64Positive = default, Option<long?> int64PositiveExclusive = default, Option<int?> integer = default, Option<string> patternWithBackslash = default, Option<string> patternWithDigits = default, Option<string> patternWithDigitsAndDelimiter = default, Option<string> @string = default, Option<decimal?> stringFormattedAsDecimal = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
64+
public FormatTest(byte[] @byte, DateTime date, decimal number, string password, decimal stringFormattedAsDecimalRequired, Option<System.IO.Stream> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> @decimal = default, Option<double?> @double = default, Option<string> duplicatePropertyName = default, Option<string> duplicatePropertyName = default, Option<float?> @float = default, Option<int?> int32 = default, Option<int?> int32Range = default, Option<long?> int64 = default, Option<long?> int64Negative = default, Option<long?> int64NegativeExclusive = default, Option<long?> int64Positive = default, Option<long?> int64PositiveExclusive = default, Option<int?> integer = default, Option<string> patternWithBackslash = default, Option<string> patternWithDigits = default, Option<string> patternWithDigitsAndDelimiter = default, Option<string> @string = default, Option<decimal?> stringFormattedAsDecimal = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
6565
{
6666
Byte = @byte;
6767
Date = date;
@@ -72,7 +72,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
7272
DateTimeOption = dateTime;
7373
DecimalOption = @decimal;
7474
DoubleOption = @double;
75-
DuplicatePropertyName2Option = duplicatePropertyName2;
75+
DuplicatePropertyNameOption = duplicatePropertyName;
7676
DuplicatePropertyNameOption = duplicatePropertyName;
7777
FloatOption = @float;
7878
Int32Option = int32;
@@ -181,17 +181,17 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
181181
public double? Double { get { return this.DoubleOption; } set { this.DoubleOption = new Option<double?>(value); } }
182182

183183
/// <summary>
184-
/// Used to track the state of DuplicatePropertyName2
184+
/// Used to track the state of DuplicatePropertyName
185185
/// </summary>
186186
[JsonIgnore]
187187
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
188-
public Option<string> DuplicatePropertyName2Option { get; private set; }
188+
public Option<string> DuplicatePropertyNameOption { get; private set; }
189189

190190
/// <summary>
191-
/// Gets or Sets DuplicatePropertyName2
191+
/// Gets or Sets DuplicatePropertyName
192192
/// </summary>
193193
[JsonPropertyName("duplicate_property_name")]
194-
public string DuplicatePropertyName2 { get { return this.DuplicatePropertyName2Option; } set { this.DuplicatePropertyName2Option = new Option<string>(value); } }
194+
public string DuplicatePropertyName { get { return this.DuplicatePropertyNameOption; } set { this.DuplicatePropertyNameOption = new Option<string>(value); } }
195195

196196
/// <summary>
197197
/// Used to track the state of DuplicatePropertyName
@@ -454,7 +454,7 @@ public override string ToString()
454454
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
455455
sb.Append(" Decimal: ").Append(Decimal).Append("\n");
456456
sb.Append(" Double: ").Append(Double).Append("\n");
457-
sb.Append(" DuplicatePropertyName2: ").Append(DuplicatePropertyName2).Append("\n");
457+
sb.Append(" DuplicatePropertyName: ").Append(DuplicatePropertyName).Append("\n");
458458
sb.Append(" DuplicatePropertyName: ").Append(DuplicatePropertyName).Append("\n");
459459
sb.Append(" Float: ").Append(Float).Append("\n");
460460
sb.Append(" Int32: ").Append(Int32).Append("\n");
@@ -690,7 +690,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
690690
Option<DateTime?> dateTime = default;
691691
Option<decimal?> varDecimal = default;
692692
Option<double?> varDouble = default;
693-
Option<string> duplicatePropertyName2 = default;
693+
Option<string> duplicatePropertyName = default;
694694
Option<string> duplicatePropertyName = default;
695695
Option<float?> varFloat = default;
696696
Option<int?> int32 = default;
@@ -753,7 +753,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
753753
varDouble = new Option<double?>(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble());
754754
break;
755755
case "duplicate_property_name":
756-
duplicatePropertyName2 = new Option<string>(utf8JsonReader.GetString());
756+
duplicatePropertyName = new Option<string>(utf8JsonReader.GetString());
757757
break;
758758
case "@duplicate_property_name":
759759
duplicatePropertyName = new Option<string>(utf8JsonReader.GetString());
@@ -857,8 +857,8 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
857857
if (varDouble.IsSet && varDouble.Value == null)
858858
throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest.");
859859

860-
if (duplicatePropertyName2.IsSet && duplicatePropertyName2.Value == null)
861-
throw new ArgumentNullException(nameof(duplicatePropertyName2), "Property is not nullable for class FormatTest.");
860+
if (duplicatePropertyName.IsSet && duplicatePropertyName.Value == null)
861+
throw new ArgumentNullException(nameof(duplicatePropertyName), "Property is not nullable for class FormatTest.");
862862

863863
if (duplicatePropertyName.IsSet && duplicatePropertyName.Value == null)
864864
throw new ArgumentNullException(nameof(duplicatePropertyName), "Property is not nullable for class FormatTest.");
@@ -914,7 +914,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
914914
if (uuid.IsSet && uuid.Value == null)
915915
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest.");
916916

917-
return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, stringFormattedAsDecimalRequired.Value.Value, binary, dateTime, varDecimal, varDouble, duplicatePropertyName2, duplicatePropertyName, varFloat, int32, int32Range, int64, int64Negative, int64NegativeExclusive, int64Positive, int64PositiveExclusive, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, stringFormattedAsDecimal, unsignedInteger, unsignedLong, uuid);
917+
return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, stringFormattedAsDecimalRequired.Value.Value, binary, dateTime, varDecimal, varDouble, duplicatePropertyName, duplicatePropertyName, varFloat, int32, int32Range, int64, int64Negative, int64NegativeExclusive, int64Positive, int64PositiveExclusive, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, stringFormattedAsDecimal, unsignedInteger, unsignedLong, uuid);
918918
}
919919

920920
/// <summary>
@@ -950,8 +950,8 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe
950950
if (formatTest.BinaryOption.IsSet && formatTest.Binary == null)
951951
throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest.");
952952

953-
if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null)
954-
throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest.");
953+
if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null)
954+
throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest.");
955955

956956
if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null)
957957
throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest.");
@@ -994,8 +994,8 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe
994994
if (formatTest.DoubleOption.IsSet)
995995
writer.WriteNumber("double", formatTest.DoubleOption.Value.Value);
996996

997-
if (formatTest.DuplicatePropertyName2Option.IsSet)
998-
writer.WriteString("duplicate_property_name", formatTest.DuplicatePropertyName2);
997+
if (formatTest.DuplicatePropertyNameOption.IsSet)
998+
writer.WriteString("duplicate_property_name", formatTest.DuplicatePropertyName);
999999

10001000
if (formatTest.DuplicatePropertyNameOption.IsSet)
10011001
writer.WriteString("@duplicate_property_name", formatTest.DuplicatePropertyName);

0 commit comments

Comments
 (0)