forked from loafle/openapi-generator-original
[C#][netcore] Add discriminator support to oneOf lookup (#7626)
* add discriminator support to oneOf lookup * fix type check, removed unused code * fix type check * add options * setLegacyDiscriminatorBehavior * fix typo * replace break with return * use packageName
This commit is contained in:
parent
931c4e361f
commit
4acc8eab45
@ -7,3 +7,4 @@ additionalProperties:
|
|||||||
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
||||||
useCompareNetObjects: true
|
useCompareNetObjects: true
|
||||||
disallowAdditionalPropertiesIfNotPresent: false
|
disallowAdditionalPropertiesIfNotPresent: false
|
||||||
|
useOneOfDiscriminatorLookup: true
|
||||||
|
@ -9,6 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ------ | ----------- | ------ | ------- |
|
| ------ | ----------- | ------ | ------- |
|
||||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|
||||||
|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|
||||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||||
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|
||||||
|licenseId|The identifier of the license| |null|
|
|licenseId|The identifier of the license| |null|
|
||||||
@ -30,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|targetFramework|The target .NET framework version.|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd></dl>|netstandard2.0|
|
|targetFramework|The target .NET framework version.|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd></dl>|netstandard2.0|
|
||||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
||||||
|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |false|
|
||||||
|validatable|Generates self-validatable models.| |true|
|
|validatable|Generates self-validatable models.| |true|
|
||||||
|
|
||||||
## IMPORT MAPPING
|
## IMPORT MAPPING
|
||||||
|
@ -89,6 +89,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
protected String releaseNote = "Minor update";
|
protected String releaseNote = "Minor update";
|
||||||
protected String licenseId;
|
protected String licenseId;
|
||||||
protected String packageTags;
|
protected String packageTags;
|
||||||
|
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||||
|
|
||||||
public CSharpNetCoreClientCodegen() {
|
public CSharpNetCoreClientCodegen() {
|
||||||
super();
|
super();
|
||||||
@ -190,6 +191,21 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
CodegenConstants.DOTNET_FRAMEWORK_DESC
|
CodegenConstants.DOTNET_FRAMEWORK_DESC
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean(
|
||||||
|
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT,
|
||||||
|
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString());
|
||||||
|
Map<String, String> disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>();
|
||||||
|
disallowAdditionalPropertiesIfNotPresentOpts.put("false",
|
||||||
|
"The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.");
|
||||||
|
disallowAdditionalPropertiesIfNotPresentOpts.put("true",
|
||||||
|
"when the 'additionalProperties' keyword is not present in a schema, " +
|
||||||
|
"the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " +
|
||||||
|
"Note: this mode is not compliant with the JSON schema specification. " +
|
||||||
|
"This is the original openapi-generator behavior.");
|
||||||
|
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
|
||||||
|
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
|
||||||
|
this.setDisallowAdditionalPropertiesIfNotPresent(true);
|
||||||
|
|
||||||
ImmutableMap.Builder<String, String> frameworkBuilder = new ImmutableMap.Builder<>();
|
ImmutableMap.Builder<String, String> frameworkBuilder = new ImmutableMap.Builder<>();
|
||||||
for (FrameworkStrategy frameworkStrategy : frameworkStrategies) {
|
for (FrameworkStrategy frameworkStrategy : frameworkStrategies) {
|
||||||
frameworkBuilder.put(frameworkStrategy.name, frameworkStrategy.description);
|
frameworkBuilder.put(frameworkStrategy.name, frameworkStrategy.description);
|
||||||
@ -261,6 +277,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
CodegenConstants.VALIDATABLE_DESC,
|
CodegenConstants.VALIDATABLE_DESC,
|
||||||
this.validatable);
|
this.validatable);
|
||||||
|
|
||||||
|
addSwitch(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP,
|
||||||
|
CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC,
|
||||||
|
this.caseInsensitiveResponseHeaders);
|
||||||
|
|
||||||
addSwitch(CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS,
|
addSwitch(CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS,
|
||||||
CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS_DESC,
|
CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS_DESC,
|
||||||
this.caseInsensitiveResponseHeaders);
|
this.caseInsensitiveResponseHeaders);
|
||||||
@ -507,6 +527,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
|
this.setLegacyDiscriminatorBehavior(false);
|
||||||
|
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -518,6 +540,11 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
* if (additionalProperties.containsKey(prop)) convertPropertyToBooleanAndWriteBack(prop);
|
* if (additionalProperties.containsKey(prop)) convertPropertyToBooleanAndWriteBack(prop);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) {
|
||||||
|
this.setDisallowAdditionalPropertiesIfNotPresent(Boolean.valueOf(additionalProperties
|
||||||
|
.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString()));
|
||||||
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES)) {
|
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES)) {
|
||||||
setOptionalEmitDefaultValuesFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES));
|
setOptionalEmitDefaultValuesFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES));
|
||||||
} else {
|
} else {
|
||||||
@ -584,6 +611,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
syncBooleanProperty(additionalProperties, CodegenConstants.SUPPORTS_ASYNC, this::setSupportsAsync, this.supportsAsync);
|
syncBooleanProperty(additionalProperties, CodegenConstants.SUPPORTS_ASYNC, this::setSupportsAsync, this.supportsAsync);
|
||||||
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_METHOD_ARGUMENT, this::setOptionalMethodArgumentFlag, optionalMethodArgumentFlag);
|
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_METHOD_ARGUMENT, this::setOptionalMethodArgumentFlag, optionalMethodArgumentFlag);
|
||||||
syncBooleanProperty(additionalProperties, CodegenConstants.NON_PUBLIC_API, this::setNonPublicApi, isNonPublicApi());
|
syncBooleanProperty(additionalProperties, CodegenConstants.NON_PUBLIC_API, this::setNonPublicApi, isNonPublicApi());
|
||||||
|
syncBooleanProperty(additionalProperties, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup, this.useOneOfDiscriminatorLookup);
|
||||||
|
|
||||||
final String testPackageName = testPackageName();
|
final String testPackageName = testPackageName();
|
||||||
String packageFolder = sourceFolder + File.separator + packageName;
|
String packageFolder = sourceFolder + File.separator + packageName;
|
||||||
@ -660,7 +688,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
this.optionalAssemblyInfoFlag = flag;
|
this.optionalAssemblyInfoFlag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOptionalEmitDefaultValuesFlag(boolean flag){
|
public void setOptionalEmitDefaultValuesFlag(boolean flag) {
|
||||||
this.optionalEmitDefaultValuesFlag = flag;
|
this.optionalEmitDefaultValuesFlag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,6 +749,14 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
this.packageTags = packageTags;
|
this.packageTags = packageTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) {
|
||||||
|
this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUseOneOfDiscriminatorLookup() {
|
||||||
|
return this.useOneOfDiscriminatorLookup;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toEnumVarName(String value, String datatype) {
|
public String toEnumVarName(String value, String datatype) {
|
||||||
if (value.length() == 0) {
|
if (value.length() == 0) {
|
||||||
|
@ -58,12 +58,17 @@ namespace {{packageName}}.Client
|
|||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serialize the object into a JSON string.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be serialized.</param>
|
||||||
|
/// <returns>A JSON string.</returns>
|
||||||
public string Serialize(object obj)
|
public string Serialize(object obj)
|
||||||
{
|
{
|
||||||
if (obj != null && obj.GetType().IsInstanceOfType(typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema)))
|
if (obj != null && obj is {{{packageName}}}.Model.AbstractOpenAPISchema)
|
||||||
{
|
{
|
||||||
// the object to be serialized is an oneOf/anyOf schema
|
// the object to be serialized is an oneOf/anyOf schema
|
||||||
return ((Org.OpenAPITools.Model.AbstractOpenAPISchema)obj).ToJson();
|
return (({{{packageName}}}.Model.AbstractOpenAPISchema)obj).ToJson();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -128,17 +133,7 @@ namespace {{packageName}}.Client
|
|||||||
// at this point, it must be a model (json)
|
// at this point, it must be a model (json)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (type.IsInstanceOfType(typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema)))
|
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
|
||||||
{
|
|
||||||
// the response is an oneOf/anyOf schema
|
|
||||||
Org.OpenAPITools.Model.AbstractOpenAPISchema instance = (Org.OpenAPITools.Model.AbstractOpenAPISchema)Activator.CreateInstance(type);
|
|
||||||
instance.FromJson(response.Content);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -456,7 +451,7 @@ namespace {{packageName}}.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
if (typeof({{{packageName}}}.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||||
{
|
{
|
||||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||||
@ -559,11 +554,11 @@ namespace {{packageName}}.Client
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
|
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
if (typeof({{{packageName}}}.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||||
{
|
{
|
||||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||||
|
@ -11,6 +11,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}
|
{{#model}}
|
||||||
{{#discriminator}}
|
{{#discriminator}}
|
||||||
|
@ -94,6 +94,24 @@
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
{{#useOneOfDiscriminatorLookup}}
|
||||||
|
{{#discriminator}}
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["{{{propertyBaseName}}}"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
{{#mappedModels}}
|
||||||
|
case "{{{mappingName}}}":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<{{{modelName}}}>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
{{/mappedModels}}
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/discriminator}}
|
||||||
|
{{/useOneOfDiscriminatorLookup}}
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
{{#oneOf}}
|
{{#oneOf}}
|
||||||
@ -107,8 +125,7 @@
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into {{{.}}}: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
{{/oneOf}}
|
{{/oneOf}}
|
||||||
|
|
||||||
|
@ -31,6 +31,28 @@ namespace Org.OpenAPITools.Test
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test GetServerUrl
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void testOneOfSchemaWithDiscriminator()
|
||||||
|
{
|
||||||
|
// Mammal can be one of whale, pig and zebra.
|
||||||
|
// pig has sub-classes.
|
||||||
|
|
||||||
|
String str = "{ \"className\": \"whale\", \"hasBaleen\": true, \"hasTeeth\": false }";
|
||||||
|
Mammal m = new Mammal();
|
||||||
|
m.FromJson(str);
|
||||||
|
Assert.NotNull(m);
|
||||||
|
Assert.IsType<Whale>(m.ActualInstance);
|
||||||
|
|
||||||
|
String str2 = "{ \"className\": \"zebra\", \"type\": \"plains\" }";
|
||||||
|
Mammal m2 = new Mammal();
|
||||||
|
m2.FromJson(str2);
|
||||||
|
Assert.NotNull(m2);
|
||||||
|
Assert.IsType<Zebra>(m2.ActualInstance);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test Fruit
|
/// Test Fruit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -63,9 +63,14 @@ namespace Org.OpenAPITools.Client
|
|||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serialize the object into a JSON string.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be serialized.</param>
|
||||||
|
/// <returns>A JSON string.</returns>
|
||||||
public string Serialize(object obj)
|
public string Serialize(object obj)
|
||||||
{
|
{
|
||||||
if (obj != null && obj.GetType().IsInstanceOfType(typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema)))
|
if (obj != null && obj is Org.OpenAPITools.Model.AbstractOpenAPISchema)
|
||||||
{
|
{
|
||||||
// the object to be serialized is an oneOf/anyOf schema
|
// the object to be serialized is an oneOf/anyOf schema
|
||||||
return ((Org.OpenAPITools.Model.AbstractOpenAPISchema)obj).ToJson();
|
return ((Org.OpenAPITools.Model.AbstractOpenAPISchema)obj).ToJson();
|
||||||
@ -133,17 +138,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
// at this point, it must be a model (json)
|
// at this point, it must be a model (json)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (type.IsInstanceOfType(typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema)))
|
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
|
||||||
{
|
|
||||||
// the response is an oneOf/anyOf schema
|
|
||||||
Org.OpenAPITools.Model.AbstractOpenAPISchema instance = (Org.OpenAPITools.Model.AbstractOpenAPISchema)Activator.CreateInstance(type);
|
|
||||||
instance.FromJson(response.Content);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -562,7 +557,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
|
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -33,8 +34,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
|
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
|
||||||
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
||||||
|
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
||||||
public partial class Animal : IEquatable<Animal>, IValidatableObject
|
public partial class Animal : IEquatable<Animal>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,8 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
@ -29,6 +31,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Cat
|
/// Cat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract(Name = "Cat")]
|
[DataContract(Name = "Cat")]
|
||||||
|
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
|
||||||
public partial class Cat : Animal, IEquatable<Cat>, IValidatableObject
|
public partial class Cat : Animal, IEquatable<Cat>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -129,6 +132,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="validationContext">Validation context</param>
|
/// <param name="validationContext">Validation context</param>
|
||||||
/// <returns>Validation Result</returns>
|
/// <returns>Validation Result</returns>
|
||||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
{
|
{
|
||||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||||
yield break;
|
yield break;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,8 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
@ -29,6 +31,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// ChildCat
|
/// ChildCat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract(Name = "ChildCat")]
|
[DataContract(Name = "ChildCat")]
|
||||||
|
[JsonConverter(typeof(JsonSubtypes), "PetType")]
|
||||||
public partial class ChildCat : ParentPet, IEquatable<ChildCat>, IValidatableObject
|
public partial class ChildCat : ParentPet, IEquatable<ChildCat>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -151,6 +154,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="validationContext">Validation context</param>
|
/// <param name="validationContext">Validation context</param>
|
||||||
/// <returns>Validation Result</returns>
|
/// <returns>Validation Result</returns>
|
||||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
{
|
{
|
||||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||||
yield break;
|
yield break;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,8 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
@ -29,6 +31,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Dog
|
/// Dog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract(Name = "Dog")]
|
[DataContract(Name = "Dog")]
|
||||||
|
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
|
||||||
public partial class Dog : Animal, IEquatable<Dog>, IValidatableObject
|
public partial class Dog : Animal, IEquatable<Dog>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -130,6 +133,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="validationContext">Validation context</param>
|
/// <param name="validationContext">Validation context</param>
|
||||||
/// <returns>Validation Result</returns>
|
/// <returns>Validation Result</returns>
|
||||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
{
|
{
|
||||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||||
yield break;
|
yield break;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
@ -153,8 +154,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Apple: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -166,8 +166,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Banana: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
@ -153,8 +154,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into AppleReq: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -166,8 +166,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into BananaReq: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -33,8 +34,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConverter(typeof(JsonSubtypes), "PetType")]
|
[JsonConverter(typeof(JsonSubtypes), "PetType")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
|
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
|
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
|
|
||||||
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
|
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
|
||||||
|
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
|
||||||
public partial class GrandparentAnimal : IEquatable<GrandparentAnimal>, IValidatableObject
|
public partial class GrandparentAnimal : IEquatable<GrandparentAnimal>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -168,6 +169,24 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "Pig":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Pig>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "whale":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Whale>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "zebra":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Zebra>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for Mammal. Possible values: Pig whale zebra", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -180,8 +199,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Pig: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -193,8 +211,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Whale: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -206,8 +223,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Zebra: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -142,6 +143,21 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "Quadrilateral":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Quadrilateral>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "Triangle":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Triangle>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -154,8 +170,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Quadrilateral: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -167,8 +182,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Triangle: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,8 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
@ -29,6 +31,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// ParentPet
|
/// ParentPet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract(Name = "ParentPet")]
|
[DataContract(Name = "ParentPet")]
|
||||||
|
[JsonConverter(typeof(JsonSubtypes), "PetType")]
|
||||||
|
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
|
||||||
|
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
|
||||||
public partial class ParentPet : GrandparentAnimal, IEquatable<ParentPet>, IValidatableObject
|
public partial class ParentPet : GrandparentAnimal, IEquatable<ParentPet>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -118,6 +123,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="validationContext">Validation context</param>
|
/// <param name="validationContext">Validation context</param>
|
||||||
/// <returns>Validation Result</returns>
|
/// <returns>Validation Result</returns>
|
||||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
{
|
{
|
||||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||||
yield break;
|
yield break;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -142,6 +143,21 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["className"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "BasquePig":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<BasquePig>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "DanishPig":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<DanishPig>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for Pig. Possible values: BasquePig DanishPig", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -154,8 +170,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into BasquePig: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -167,8 +182,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into DanishPig: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -142,6 +143,21 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["quadrilateralType"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "ComplexQuadrilateral":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<ComplexQuadrilateral>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "SimpleQuadrilateral":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<SimpleQuadrilateral>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -154,8 +170,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into ComplexQuadrilateral: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -167,8 +182,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into SimpleQuadrilateral: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -142,6 +143,21 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "Quadrilateral":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Quadrilateral>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "Triangle":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Triangle>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -154,8 +170,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Quadrilateral: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -167,8 +182,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Triangle: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -142,6 +143,21 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["shapeType"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "Quadrilateral":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Quadrilateral>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "Triangle":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<Triangle>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -154,8 +170,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Quadrilateral: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -167,8 +182,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into Triangle: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -168,6 +169,24 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="jsonString">JSON string</param>
|
/// <param name="jsonString">JSON string</param>
|
||||||
public override void FromJson(string jsonString)
|
public override void FromJson(string jsonString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string discriminatorValue = JObject.Parse(jsonString)["triangleType"].ToString();
|
||||||
|
switch (discriminatorValue)
|
||||||
|
{
|
||||||
|
case "EquilateralTriangle":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<EquilateralTriangle>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "IsoscelesTriangle":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<IsoscelesTriangle>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
case "ScaleneTriangle":
|
||||||
|
this.ActualInstance = JsonConvert.DeserializeObject<ScaleneTriangle>(jsonString, _serializerSettings);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to lookup discriminator value `%s` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
List<string> matchedTypes = new List<string>();
|
List<string> matchedTypes = new List<string>();
|
||||||
|
|
||||||
@ -180,8 +199,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into EquilateralTriangle: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -193,8 +211,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into IsoscelesTriangle: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -206,8 +223,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
// deserialization failed, try the next one
|
// deserialization failed, try the next one
|
||||||
// uncomment the line below for troubleshooting
|
System.Diagnostics.Debug.WriteLine(String.Format("Failed to deserialize `%s` into ScaleneTriangle: %s", jsonString, exception.ToString()));
|
||||||
//Console.WriteLine(exception.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match == 0)
|
if (match == 0)
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -64,9 +64,14 @@ namespace Org.OpenAPITools.Client
|
|||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serialize the object into a JSON string.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be serialized.</param>
|
||||||
|
/// <returns>A JSON string.</returns>
|
||||||
public string Serialize(object obj)
|
public string Serialize(object obj)
|
||||||
{
|
{
|
||||||
if (obj != null && obj.GetType().IsInstanceOfType(typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema)))
|
if (obj != null && obj is Org.OpenAPITools.Model.AbstractOpenAPISchema)
|
||||||
{
|
{
|
||||||
// the object to be serialized is an oneOf/anyOf schema
|
// the object to be serialized is an oneOf/anyOf schema
|
||||||
return ((Org.OpenAPITools.Model.AbstractOpenAPISchema)obj).ToJson();
|
return ((Org.OpenAPITools.Model.AbstractOpenAPISchema)obj).ToJson();
|
||||||
@ -134,17 +139,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
// at this point, it must be a model (json)
|
// at this point, it must be a model (json)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (type.IsInstanceOfType(typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema)))
|
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
|
||||||
{
|
|
||||||
// the response is an oneOf/anyOf schema
|
|
||||||
Org.OpenAPITools.Model.AbstractOpenAPISchema instance = (Org.OpenAPITools.Model.AbstractOpenAPISchema)Activator.CreateInstance(type);
|
|
||||||
instance.FromJson(response.Content);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -563,7 +558,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
|
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using JsonSubTypes;
|
using JsonSubTypes;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
@ -33,8 +34,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
|
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
||||||
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
|
||||||
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
|
||||||
|
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
|
||||||
public partial class Animal : IEquatable<Animal>, IValidatableObject
|
public partial class Animal : IEquatable<Animal>, IValidatableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
@ -19,6 +19,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user