forked from loafle/openapi-generator-original
[chsarp-netcore]handle the exception to get correct error message. (#10207)
* handle the exception to get meaningful message. * minor code format enhancement, update samples Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
parent
4e3a98cee4
commit
a71258d7f7
@ -494,9 +494,16 @@ namespace {{packageName}}.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
@ -107,7 +107,10 @@
|
||||
{{#useOneOfDiscriminatorLookup}}
|
||||
{{#discriminator}}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["{{{propertyBaseName}}}"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["{{{propertyBaseName}}}"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
{{#mappedModels}}
|
||||
@ -119,6 +122,11 @@
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
{{/discriminator}}
|
||||
{{/useOneOfDiscriminatorLookup}}
|
||||
|
@ -493,9 +493,16 @@ namespace Org.OpenAPITools.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newMammal;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Pig":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Mammal. Possible values: Pig whale zebra", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newNullableShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newPig;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "BasquePig":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Pig. Possible values: BasquePig DanishPig", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newQuadrilateral;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["quadrilateralType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["quadrilateralType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "ComplexQuadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShapeOrNull;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newTriangle;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["triangleType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["triangleType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "EquilateralTriangle":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -171,7 +171,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newMammal;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Pig":
|
||||
@ -187,6 +190,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Mammal. Possible values: Pig whale zebra", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -154,7 +154,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newNullableShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -167,6 +170,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -145,7 +145,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newPig;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "BasquePig":
|
||||
@ -158,6 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Pig. Possible values: BasquePig DanishPig", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -145,7 +145,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newQuadrilateral;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["quadrilateralType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["quadrilateralType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "ComplexQuadrilateral":
|
||||
@ -158,6 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -145,7 +145,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -158,6 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -154,7 +154,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShapeOrNull;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -167,6 +170,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -171,7 +171,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newTriangle;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["triangleType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["triangleType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "EquilateralTriangle":
|
||||
@ -187,6 +190,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -494,9 +494,16 @@ namespace Org.OpenAPITools.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newMammal;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Pig":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Mammal. Possible values: Pig whale zebra", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newNullableShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newPig;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "BasquePig":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Pig. Possible values: BasquePig DanishPig", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newQuadrilateral;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["quadrilateralType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["quadrilateralType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "ComplexQuadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShapeOrNull;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newTriangle;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["triangleType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["triangleType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "EquilateralTriangle":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -494,9 +494,16 @@ namespace Org.OpenAPITools.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newMammal;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Pig":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Mammal. Possible values: Pig whale zebra", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newNullableShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newPig;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "BasquePig":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Pig. Possible values: BasquePig DanishPig", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newQuadrilateral;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["quadrilateralType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["quadrilateralType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "ComplexQuadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShapeOrNull;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newTriangle;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["triangleType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["triangleType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "EquilateralTriangle":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -493,9 +493,16 @@ namespace Org.OpenAPITools.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newMammal;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Pig":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Mammal. Possible values: Pig whale zebra", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newNullableShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newPig;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["className"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "BasquePig":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Pig. Possible values: BasquePig DanishPig", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newQuadrilateral;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["quadrilateralType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["quadrilateralType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "ComplexQuadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -144,7 +144,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShape;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -157,6 +160,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -153,7 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newShapeOrNull;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["shapeType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "Quadrilateral":
|
||||
@ -166,6 +169,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -170,7 +170,10 @@ namespace Org.OpenAPITools.Model
|
||||
return newTriangle;
|
||||
}
|
||||
|
||||
string discriminatorValue = JObject.Parse(jsonString)["triangleType"].ToString();
|
||||
try
|
||||
{
|
||||
var discriminatorObj = JObject.Parse(jsonString)["triangleType"];
|
||||
string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString();
|
||||
switch (discriminatorValue)
|
||||
{
|
||||
case "EquilateralTriangle":
|
||||
@ -186,6 +189,11 @@ namespace Org.OpenAPITools.Model
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("Failed to parse the json data : `{0}` {1}", jsonString, ex.ToString()));
|
||||
}
|
||||
|
||||
int match = 0;
|
||||
List<string> matchedTypes = new List<string>();
|
||||
|
@ -494,9 +494,16 @@ namespace Org.OpenAPITools.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
@ -493,9 +493,16 @@ namespace Org.OpenAPITools.Client
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex.InnerException != null ? ex.InnerException : ex;
|
||||
}
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user