Skip to content

Commit a7eedd9

Browse files
authored
fix invalid implicit casts (#23192)
1 parent 44bc527 commit a7eedd9

182 files changed

Lines changed: 518 additions & 518 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
{{#deprecated}}
132132
[Obsolete]
133133
{{/deprecated}}
134-
public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
134+
public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option.Value; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
135135

136136
{{/isEnum}}
137137
{{/isDiscriminator}}
@@ -157,7 +157,7 @@
157157
{{#deprecated}}
158158
[Obsolete]
159159
{{/deprecated}}
160-
public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
160+
public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Option.Value; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
161161

162162
{{/vendorExtensions.x-duplicated-data-type}}
163163
{{/composedSchemas.anyOf}}
@@ -215,7 +215,7 @@
215215
{{#deprecated}}
216216
[Obsolete]
217217
{{/deprecated}}
218-
public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
218+
public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option.Value; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
219219

220220
{{/isNew}}
221221
{{/isInherited}}

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsSizeParameter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal IconsSizeParameter(Option<IconsSizeParameterAnyOf?> iconsSizeParameterA
5454
/// <summary>
5555
/// Gets or Sets IconsSizeParameterAnyOf
5656
/// </summary>
57-
public IconsSizeParameterAnyOf? IconsSizeParameterAnyOf { get { return this.IconsSizeParameterAnyOfOption; } set { this.IconsSizeParameterAnyOfOption = new(value); } }
57+
public IconsSizeParameterAnyOf? IconsSizeParameterAnyOf { get { return this.IconsSizeParameterAnyOfOption.Value; } set { this.IconsSizeParameterAnyOfOption = new(value); } }
5858

5959
/// <summary>
6060
/// Used to track the state of Int
@@ -66,7 +66,7 @@ internal IconsSizeParameter(Option<IconsSizeParameterAnyOf?> iconsSizeParameterA
6666
/// <summary>
6767
/// Gets or Sets Int
6868
/// </summary>
69-
public int? Int { get { return this.IntOption; } set { this.IntOption = new(value); } }
69+
public int? Int { get { return this.IntOption.Value; } set { this.IntOption = new(value); } }
7070

7171
/// <summary>
7272
/// Returns the string presentation of the object

samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public Fruit(Option<Apple?> apple, Option<Banana?> banana, Option<string?> color
5757
/// <summary>
5858
/// Gets or Sets Apple
5959
/// </summary>
60-
public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } }
60+
public Apple? Apple { get { return this.AppleOption.Value; } set { this.AppleOption = new(value); } }
6161

6262
/// <summary>
6363
/// Used to track the state of Banana
@@ -69,7 +69,7 @@ public Fruit(Option<Apple?> apple, Option<Banana?> banana, Option<string?> color
6969
/// <summary>
7070
/// Gets or Sets Banana
7171
/// </summary>
72-
public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } }
72+
public Banana? Banana { get { return this.BananaOption.Value; } set { this.BananaOption = new(value); } }
7373

7474
/// <summary>
7575
/// Used to track the state of Color

samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Fruit(Option<Apple?> apple, Option<Banana?> banana, Option<string?> color
5656
/// <summary>
5757
/// Gets or Sets Apple
5858
/// </summary>
59-
public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } }
59+
public Apple? Apple { get { return this.AppleOption.Value; } set { this.AppleOption = new(value); } }
6060

6161
/// <summary>
6262
/// Used to track the state of Banana
@@ -68,7 +68,7 @@ public Fruit(Option<Apple?> apple, Option<Banana?> banana, Option<string?> color
6868
/// <summary>
6969
/// Gets or Sets Banana
7070
/// </summary>
71-
public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } }
71+
public Banana? Banana { get { return this.BananaOption.Value; } set { this.BananaOption = new(value); } }
7272

7373
/// <summary>
7474
/// Used to track the state of Color

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public EnumArrays(Option<List<EnumArraysArrayEnumInner>> arrayEnum = default, Op
5555
/// Gets or Sets JustSymbol
5656
/// </summary>
5757
[JsonPropertyName("just_symbol")]
58-
public EnumArraysJustSymbol? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } }
58+
public EnumArraysJustSymbol? JustSymbol { get { return this.JustSymbolOption.Value; } set { this.JustSymbolOption = new(value); } }
5959

6060
/// <summary>
6161
/// Used to track the state of ArrayEnum

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
7575
/// Gets or Sets EnumInteger
7676
/// </summary>
7777
[JsonPropertyName("enum_integer")]
78-
public EnumTestEnumInteger? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } }
78+
public EnumTestEnumInteger? EnumInteger { get { return this.EnumIntegerOption.Value; } set { this.EnumIntegerOption = new(value); } }
7979

8080
/// <summary>
8181
/// Used to track the state of EnumIntegerOnly
@@ -88,7 +88,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
8888
/// Gets or Sets EnumIntegerOnly
8989
/// </summary>
9090
[JsonPropertyName("enum_integer_only")]
91-
public EnumTestEnumIntegerOnly? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } }
91+
public EnumTestEnumIntegerOnly? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption.Value; } set { this.EnumIntegerOnlyOption = new(value); } }
9292

9393
/// <summary>
9494
/// Used to track the state of EnumNumber
@@ -101,7 +101,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
101101
/// Gets or Sets EnumNumber
102102
/// </summary>
103103
[JsonPropertyName("enum_number")]
104-
public TestEnumParametersEnumQueryDoubleParameter? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } }
104+
public TestEnumParametersEnumQueryDoubleParameter? EnumNumber { get { return this.EnumNumberOption.Value; } set { this.EnumNumberOption = new(value); } }
105105

106106
/// <summary>
107107
/// Used to track the state of EnumString
@@ -114,7 +114,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
114114
/// Gets or Sets EnumString
115115
/// </summary>
116116
[JsonPropertyName("enum_string")]
117-
public EnumTestEnumString? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } }
117+
public EnumTestEnumString? EnumString { get { return this.EnumStringOption.Value; } set { this.EnumStringOption = new(value); } }
118118

119119
/// <summary>
120120
/// Used to track the state of OuterEnum
@@ -127,7 +127,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
127127
/// Gets or Sets OuterEnum
128128
/// </summary>
129129
[JsonPropertyName("outerEnum")]
130-
public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } }
130+
public OuterEnum? OuterEnum { get { return this.OuterEnumOption.Value; } set { this.OuterEnumOption = new(value); } }
131131

132132
/// <summary>
133133
/// Used to track the state of OuterEnumDefaultValue
@@ -140,7 +140,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
140140
/// Gets or Sets OuterEnumDefaultValue
141141
/// </summary>
142142
[JsonPropertyName("outerEnumDefaultValue")]
143-
public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } }
143+
public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption.Value; } set { this.OuterEnumDefaultValueOption = new(value); } }
144144

145145
/// <summary>
146146
/// Used to track the state of OuterEnumInteger
@@ -153,7 +153,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
153153
/// Gets or Sets OuterEnumInteger
154154
/// </summary>
155155
[JsonPropertyName("outerEnumInteger")]
156-
public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } }
156+
public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption.Value; } set { this.OuterEnumIntegerOption = new(value); } }
157157

158158
/// <summary>
159159
/// Used to track the state of OuterEnumIntegerDefaultValue
@@ -166,7 +166,7 @@ public EnumTest(EnumTestEnumString enumStringRequired, Option<EnumTestEnumIntege
166166
/// Gets or Sets OuterEnumIntegerDefaultValue
167167
/// </summary>
168168
[JsonPropertyName("outerEnumIntegerDefaultValue")]
169-
public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } }
169+
public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption.Value; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } }
170170

171171
/// <summary>
172172
/// Gets or Sets additional properties

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public GmFruit(Option<Apple> apple, Option<Banana> banana, Option<string> color
5555
/// <summary>
5656
/// Gets or Sets Apple
5757
/// </summary>
58-
public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } }
58+
public Apple Apple { get { return this.AppleOption.Value; } set { this.AppleOption = new(value); } }
5959

6060
/// <summary>
6161
/// Used to track the state of Banana
@@ -67,7 +67,7 @@ public GmFruit(Option<Apple> apple, Option<Banana> banana, Option<string> color
6767
/// <summary>
6868
/// Gets or Sets Banana
6969
/// </summary>
70-
public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } }
70+
public Banana Banana { get { return this.BananaOption.Value; } set { this.BananaOption = new(value); } }
7171

7272
/// <summary>
7373
/// Used to track the state of Color

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public MixedAnyOfContent(Option<string> @string, Option<bool?> @bool, Option<int
5959
/// <summary>
6060
/// Gets or Sets String
6161
/// </summary>
62-
public string String { get { return this.StringOption; } set { this.StringOption = new(value); } }
62+
public string String { get { return this.StringOption.Value; } set { this.StringOption = new(value); } }
6363

6464
/// <summary>
6565
/// Used to track the state of Bool
@@ -71,7 +71,7 @@ public MixedAnyOfContent(Option<string> @string, Option<bool?> @bool, Option<int
7171
/// <summary>
7272
/// Gets or Sets Bool
7373
/// </summary>
74-
public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new(value); } }
74+
public bool? Bool { get { return this.BoolOption.Value; } set { this.BoolOption = new(value); } }
7575

7676
/// <summary>
7777
/// Used to track the state of Int
@@ -83,7 +83,7 @@ public MixedAnyOfContent(Option<string> @string, Option<bool?> @bool, Option<int
8383
/// <summary>
8484
/// Gets or Sets Int
8585
/// </summary>
86-
public int? Int { get { return this.IntOption; } set { this.IntOption = new(value); } }
86+
public int? Int { get { return this.IntOption.Value; } set { this.IntOption = new(value); } }
8787

8888
/// <summary>
8989
/// Used to track the state of Decimal
@@ -95,7 +95,7 @@ public MixedAnyOfContent(Option<string> @string, Option<bool?> @bool, Option<int
9595
/// <summary>
9696
/// Gets or Sets Decimal
9797
/// </summary>
98-
public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } }
98+
public decimal? Decimal { get { return this.DecimalOption.Value; } set { this.DecimalOption = new(value); } }
9999

100100
/// <summary>
101101
/// Used to track the state of MixedSubId
@@ -107,7 +107,7 @@ public MixedAnyOfContent(Option<string> @string, Option<bool?> @bool, Option<int
107107
/// <summary>
108108
/// Gets or Sets MixedSubId
109109
/// </summary>
110-
public MixedSubId MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new(value); } }
110+
public MixedSubId MixedSubId { get { return this.MixedSubIdOption.Value; } set { this.MixedSubIdOption = new(value); } }
111111

112112
/// <summary>
113113
/// Gets or Sets additional properties

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Order.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Order(Option<bool?> complete = default, Option<long?> id = default, Optio
6363
/// Gets or Sets Status
6464
/// </summary>
6565
[JsonPropertyName("status")]
66-
public OrderStatus? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } }
66+
public OrderStatus? Status { get { return this.StatusOption.Value; } set { this.StatusOption = new(value); } }
6767

6868
/// <summary>
6969
/// Used to track the state of Complete

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Pet(string name, List<string> photoUrls, Option<Category> category = defa
6363
/// Gets or Sets Status
6464
/// </summary>
6565
[JsonPropertyName("status")]
66-
public PetStatus? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } }
66+
public PetStatus? Status { get { return this.StatusOption.Value; } set { this.StatusOption = new(value); } }
6767

6868
/// <summary>
6969
/// Gets or Sets Name

0 commit comments

Comments
 (0)