Skip to content

Commit 09faef1

Browse files
committed
OneOf should handle Inheritance based type
1 parent dc81339 commit 09faef1

File tree

97 files changed

+241
-241
lines changed

Some content is hidden

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

97 files changed

+241
-241
lines changed

modules/openapi-generator/src/main/resources/csharp/modelOneOf.mustache

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
set
5757
{
5858
{{#oneOf}}
59-
{{^-first}}else {{/-first}}if (value.GetType() == typeof({{{.}}}))
59+
{{^-first}}else {{/-first}}if (value.GetType() == typeof({{{.}}}) || value is {{{.}}})
6060
{
6161
this._actualInstance = value;
6262
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/Fruit.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public override Object ActualInstance
7373
}
7474
set
7575
{
76-
if (value.GetType() == typeof(Apple))
76+
if (value.GetType() == typeof(Apple) || value is Apple)
7777
{
7878
this._actualInstance = value;
7979
}
80-
else if (value.GetType() == typeof(Banana))
80+
else if (value.GetType() == typeof(Banana) || value is Banana)
8181
{
8282
this._actualInstance = value;
8383
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public override Object ActualInstance
8282
}
8383
set
8484
{
85-
if (value.GetType() == typeof(AppleReq))
85+
if (value.GetType() == typeof(AppleReq) || value is AppleReq)
8686
{
8787
this._actualInstance = value;
8888
}
89-
else if (value.GetType() == typeof(BananaReq))
89+
else if (value.GetType() == typeof(BananaReq) || value is BananaReq)
9090
{
9191
this._actualInstance = value;
9292
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/Mammal.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ public override Object ActualInstance
8686
}
8787
set
8888
{
89-
if (value.GetType() == typeof(Pig))
89+
if (value.GetType() == typeof(Pig) || value is Pig)
9090
{
9191
this._actualInstance = value;
9292
}
93-
else if (value.GetType() == typeof(Whale))
93+
else if (value.GetType() == typeof(Whale) || value is Whale)
9494
{
9595
this._actualInstance = value;
9696
}
97-
else if (value.GetType() == typeof(Zebra))
97+
else if (value.GetType() == typeof(Zebra) || value is Zebra)
9898
{
9999
this._actualInstance = value;
100100
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,23 @@ public override Object ActualInstance
109109
}
110110
set
111111
{
112-
if (value.GetType() == typeof(MixedSubId))
112+
if (value.GetType() == typeof(MixedSubId) || value is MixedSubId)
113113
{
114114
this._actualInstance = value;
115115
}
116-
else if (value.GetType() == typeof(bool))
116+
else if (value.GetType() == typeof(bool) || value is bool)
117117
{
118118
this._actualInstance = value;
119119
}
120-
else if (value.GetType() == typeof(decimal))
120+
else if (value.GetType() == typeof(decimal) || value is decimal)
121121
{
122122
this._actualInstance = value;
123123
}
124-
else if (value.GetType() == typeof(int))
124+
else if (value.GetType() == typeof(int) || value is int)
125125
{
126126
this._actualInstance = value;
127127
}
128-
else if (value.GetType() == typeof(string))
128+
else if (value.GetType() == typeof(string) || value is string)
129129
{
130130
this._actualInstance = value;
131131
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ public override Object ActualInstance
8383
}
8484
set
8585
{
86-
if (value.GetType() == typeof(Quadrilateral))
86+
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
8787
{
8888
this._actualInstance = value;
8989
}
90-
else if (value.GetType() == typeof(Triangle))
90+
else if (value.GetType() == typeof(Triangle) || value is Triangle)
9191
{
9292
this._actualInstance = value;
9393
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public override Object ActualInstance
6161
}
6262
set
6363
{
64-
if (value.GetType() == typeof(string))
64+
if (value.GetType() == typeof(string) || value is string)
6565
{
6666
this._actualInstance = value;
6767
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pig.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public override Object ActualInstance
7474
}
7575
set
7676
{
77-
if (value.GetType() == typeof(BasquePig))
77+
if (value.GetType() == typeof(BasquePig) || value is BasquePig)
7878
{
7979
this._actualInstance = value;
8080
}
81-
else if (value.GetType() == typeof(DanishPig))
81+
else if (value.GetType() == typeof(DanishPig) || value is DanishPig)
8282
{
8383
this._actualInstance = value;
8484
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ public override Object ActualInstance
9797
}
9898
set
9999
{
100-
if (value.GetType() == typeof(List<string>))
100+
if (value.GetType() == typeof(List<string>) || value is List<string>)
101101
{
102102
this._actualInstance = value;
103103
}
104-
else if (value.GetType() == typeof(Object))
104+
else if (value.GetType() == typeof(Object) || value is Object)
105105
{
106106
this._actualInstance = value;
107107
}
108-
else if (value.GetType() == typeof(bool))
108+
else if (value.GetType() == typeof(bool) || value is bool)
109109
{
110110
this._actualInstance = value;
111111
}
112-
else if (value.GetType() == typeof(string))
112+
else if (value.GetType() == typeof(string) || value is string)
113113
{
114114
this._actualInstance = value;
115115
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public override Object ActualInstance
7474
}
7575
set
7676
{
77-
if (value.GetType() == typeof(ComplexQuadrilateral))
77+
if (value.GetType() == typeof(ComplexQuadrilateral) || value is ComplexQuadrilateral)
7878
{
7979
this._actualInstance = value;
8080
}
81-
else if (value.GetType() == typeof(SimpleQuadrilateral))
81+
else if (value.GetType() == typeof(SimpleQuadrilateral) || value is SimpleQuadrilateral)
8282
{
8383
this._actualInstance = value;
8484
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/Shape.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public override Object ActualInstance
7474
}
7575
set
7676
{
77-
if (value.GetType() == typeof(Quadrilateral))
77+
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
7878
{
7979
this._actualInstance = value;
8080
}
81-
else if (value.GetType() == typeof(Triangle))
81+
else if (value.GetType() == typeof(Triangle) || value is Triangle)
8282
{
8383
this._actualInstance = value;
8484
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ public override Object ActualInstance
8383
}
8484
set
8585
{
86-
if (value.GetType() == typeof(Quadrilateral))
86+
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
8787
{
8888
this._actualInstance = value;
8989
}
90-
else if (value.GetType() == typeof(Triangle))
90+
else if (value.GetType() == typeof(Triangle) || value is Triangle)
9191
{
9292
this._actualInstance = value;
9393
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/Triangle.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ public override Object ActualInstance
8686
}
8787
set
8888
{
89-
if (value.GetType() == typeof(EquilateralTriangle))
89+
if (value.GetType() == typeof(EquilateralTriangle) || value is EquilateralTriangle)
9090
{
9191
this._actualInstance = value;
9292
}
93-
else if (value.GetType() == typeof(IsoscelesTriangle))
93+
else if (value.GetType() == typeof(IsoscelesTriangle) || value is IsoscelesTriangle)
9494
{
9595
this._actualInstance = value;
9696
}
97-
else if (value.GetType() == typeof(ScaleneTriangle))
97+
else if (value.GetType() == typeof(ScaleneTriangle) || value is ScaleneTriangle)
9898
{
9999
this._actualInstance = value;
100100
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ public override Object ActualInstance
7272
}
7373
set
7474
{
75-
if (value.GetType() == typeof(Apple))
75+
if (value.GetType() == typeof(Apple) || value is Apple)
7676
{
7777
this._actualInstance = value;
7878
}
79-
else if (value.GetType() == typeof(Banana))
79+
else if (value.GetType() == typeof(Banana) || value is Banana)
8080
{
8181
this._actualInstance = value;
8282
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ public override Object ActualInstance
8181
}
8282
set
8383
{
84-
if (value.GetType() == typeof(AppleReq))
84+
if (value.GetType() == typeof(AppleReq) || value is AppleReq)
8585
{
8686
this._actualInstance = value;
8787
}
88-
else if (value.GetType() == typeof(BananaReq))
88+
else if (value.GetType() == typeof(BananaReq) || value is BananaReq)
8989
{
9090
this._actualInstance = value;
9191
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ public override Object ActualInstance
8585
}
8686
set
8787
{
88-
if (value.GetType() == typeof(Pig))
88+
if (value.GetType() == typeof(Pig) || value is Pig)
8989
{
9090
this._actualInstance = value;
9191
}
92-
else if (value.GetType() == typeof(Whale))
92+
else if (value.GetType() == typeof(Whale) || value is Whale)
9393
{
9494
this._actualInstance = value;
9595
}
96-
else if (value.GetType() == typeof(Zebra))
96+
else if (value.GetType() == typeof(Zebra) || value is Zebra)
9797
{
9898
this._actualInstance = value;
9999
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,23 @@ public override Object ActualInstance
108108
}
109109
set
110110
{
111-
if (value.GetType() == typeof(MixedSubId))
111+
if (value.GetType() == typeof(MixedSubId) || value is MixedSubId)
112112
{
113113
this._actualInstance = value;
114114
}
115-
else if (value.GetType() == typeof(bool))
115+
else if (value.GetType() == typeof(bool) || value is bool)
116116
{
117117
this._actualInstance = value;
118118
}
119-
else if (value.GetType() == typeof(decimal))
119+
else if (value.GetType() == typeof(decimal) || value is decimal)
120120
{
121121
this._actualInstance = value;
122122
}
123-
else if (value.GetType() == typeof(int))
123+
else if (value.GetType() == typeof(int) || value is int)
124124
{
125125
this._actualInstance = value;
126126
}
127-
else if (value.GetType() == typeof(string))
127+
else if (value.GetType() == typeof(string) || value is string)
128128
{
129129
this._actualInstance = value;
130130
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public override Object ActualInstance
8282
}
8383
set
8484
{
85-
if (value.GetType() == typeof(Quadrilateral))
85+
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
8686
{
8787
this._actualInstance = value;
8888
}
89-
else if (value.GetType() == typeof(Triangle))
89+
else if (value.GetType() == typeof(Triangle) || value is Triangle)
9090
{
9191
this._actualInstance = value;
9292
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public override Object ActualInstance
6060
}
6161
set
6262
{
63-
if (value.GetType() == typeof(string))
63+
if (value.GetType() == typeof(string) || value is string)
6464
{
6565
this._actualInstance = value;
6666
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/Pig.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public override Object ActualInstance
7373
}
7474
set
7575
{
76-
if (value.GetType() == typeof(BasquePig))
76+
if (value.GetType() == typeof(BasquePig) || value is BasquePig)
7777
{
7878
this._actualInstance = value;
7979
}
80-
else if (value.GetType() == typeof(DanishPig))
80+
else if (value.GetType() == typeof(DanishPig) || value is DanishPig)
8181
{
8282
this._actualInstance = value;
8383
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ public override Object ActualInstance
9696
}
9797
set
9898
{
99-
if (value.GetType() == typeof(List<string>))
99+
if (value.GetType() == typeof(List<string>) || value is List<string>)
100100
{
101101
this._actualInstance = value;
102102
}
103-
else if (value.GetType() == typeof(Object))
103+
else if (value.GetType() == typeof(Object) || value is Object)
104104
{
105105
this._actualInstance = value;
106106
}
107-
else if (value.GetType() == typeof(bool))
107+
else if (value.GetType() == typeof(bool) || value is bool)
108108
{
109109
this._actualInstance = value;
110110
}
111-
else if (value.GetType() == typeof(string))
111+
else if (value.GetType() == typeof(string) || value is string)
112112
{
113113
this._actualInstance = value;
114114
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public override Object ActualInstance
7373
}
7474
set
7575
{
76-
if (value.GetType() == typeof(ComplexQuadrilateral))
76+
if (value.GetType() == typeof(ComplexQuadrilateral) || value is ComplexQuadrilateral)
7777
{
7878
this._actualInstance = value;
7979
}
80-
else if (value.GetType() == typeof(SimpleQuadrilateral))
80+
else if (value.GetType() == typeof(SimpleQuadrilateral) || value is SimpleQuadrilateral)
8181
{
8282
this._actualInstance = value;
8383
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/Shape.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public override Object ActualInstance
7373
}
7474
set
7575
{
76-
if (value.GetType() == typeof(Quadrilateral))
76+
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
7777
{
7878
this._actualInstance = value;
7979
}
80-
else if (value.GetType() == typeof(Triangle))
80+
else if (value.GetType() == typeof(Triangle) || value is Triangle)
8181
{
8282
this._actualInstance = value;
8383
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public override Object ActualInstance
8282
}
8383
set
8484
{
85-
if (value.GetType() == typeof(Quadrilateral))
85+
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
8686
{
8787
this._actualInstance = value;
8888
}
89-
else if (value.GetType() == typeof(Triangle))
89+
else if (value.GetType() == typeof(Triangle) || value is Triangle)
9090
{
9191
this._actualInstance = value;
9292
}

0 commit comments

Comments
 (0)