mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
[csharp-netcore] Composed primitives support in generichost (#11924)
* refactor nrt annotation * enable nrt by default in .net6.0+ * use shorter nrt annotation * build samples * removed debugging lines * fixed model and operatoin constructors * reverted a commented line for comparison * upgraded to System.Text.Json * build samples * build samples * deleted samples to remove old files * bug fixes * bug fixes * added cumpulsory property to codegen * build samples * fixed bug * fixed bug * fixes * removed bugged code that wasnt needed * build samples * restored sorting and default values for required params * fixed bugs in comparison * fixed sort comparators * recreate tests * build samples...again... * removed debugging line breaks * simplified constructor signature * inject json options * build samples...again... * build samples * add support for composed primitives * build samples * build all samples
This commit is contained in:
parent
b54257d7ab
commit
7b6fa755c1
@ -1,7 +1,7 @@
|
||||
# for csharp-netcore generichost
|
||||
generatorName: csharp-netcore
|
||||
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||
additionalProperties:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# for csharp-netcore generichost
|
||||
generatorName: csharp-netcore
|
||||
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||
additionalProperties:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# for csharp-netcore generichost
|
||||
generatorName: csharp-netcore
|
||||
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-generichost.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||
additionalProperties:
|
||||
|
@ -1349,6 +1349,14 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
cm.anyOf.remove("Null");
|
||||
}
|
||||
|
||||
if (cm.getComposedSchemas() != null && cm.getComposedSchemas().getOneOf() != null && !cm.getComposedSchemas().getOneOf().isEmpty()) {
|
||||
cm.getComposedSchemas().getOneOf().removeIf(o -> o.dataType.equals("Null"));
|
||||
}
|
||||
|
||||
if (cm.getComposedSchemas() != null && cm.getComposedSchemas().getAnyOf() != null && !cm.getComposedSchemas().getAnyOf().isEmpty()) {
|
||||
cm.getComposedSchemas().getAnyOf().removeIf(o -> o.dataType.equals("Null"));
|
||||
}
|
||||
|
||||
for (CodegenProperty cp : cm.readWriteVars) {
|
||||
// ISSUE: https://github.com/OpenAPITools/openapi-generator/issues/11844
|
||||
// allVars may not have all properties
|
||||
@ -1385,7 +1393,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
* Check modules\openapi-generator\src\test\resources\3_0\java\petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
* Without this method, property petType in GrandparentAnimal will not make it through ParentPet and into ChildCat
|
||||
*/
|
||||
private void EnsureInheritedVariablesArePresent(CodegenModel derivedModel) {
|
||||
private void EnsureInheritedPropertiesArePresent(CodegenModel derivedModel) {
|
||||
// every c# generator should definetly want this, or we should fix the issue
|
||||
// still, lets avoid breaking changes :(
|
||||
if (Boolean.FALSE.equals(GENERICHOST.equals(getLibrary()))){
|
||||
@ -1405,7 +1413,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
EnsureInheritedVariablesArePresent(derivedModel.parentModel);
|
||||
EnsureInheritedPropertiesArePresent(derivedModel.parentModel);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1430,19 +1438,19 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
for (CodegenModel cm : allModels) {
|
||||
if (cm.parent != null){
|
||||
// remove the parent CodegenProperty from the model
|
||||
// we need it gone so we can use allOf/oneOf/anyOf in the constructor
|
||||
cm.allOf.removeIf(item -> item.equals(cm.parent));
|
||||
cm.oneOf.removeIf(item -> item.equals(cm.parent));
|
||||
cm.anyOf.removeIf(item -> item.equals(cm.parent));
|
||||
}
|
||||
|
||||
cm.anyOf.forEach(anyOf -> removePropertiesDeclaredInComposedClass(anyOf, allModels, cm));
|
||||
cm.oneOf.forEach(oneOf -> removePropertiesDeclaredInComposedClass(oneOf, allModels, cm));
|
||||
cm.allOf.forEach(allOf -> removePropertiesDeclaredInComposedClass(allOf, allModels, cm));
|
||||
|
||||
EnsureInheritedVariablesArePresent(cm);
|
||||
if (cm.getComposedSchemas() != null && cm.getComposedSchemas().getAllOf() != null && !cm.getComposedSchemas().getAllOf().isEmpty()) {
|
||||
cm.getComposedSchemas().getAllOf().forEach(allOf -> {
|
||||
if (allOf.dataType.equals(cm.parent)){
|
||||
allOf.isInherited = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
EnsureInheritedPropertiesArePresent(cm);
|
||||
}
|
||||
|
||||
return objs;
|
||||
|
@ -25,20 +25,23 @@
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
{{#anyOf}}
|
||||
Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
|
||||
Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
|
||||
{{#composedSchemas.anyOf}}
|
||||
Utf8JsonReader {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader = reader;
|
||||
bool {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized = Client.ClientUtils.TryDeserialize<{{{dataType}}}>(ref {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader, options, out {{{dataType}}}{{^isBoolean}}{{nrt?}}{{/isBoolean}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}});
|
||||
|
||||
{{/anyOf}}
|
||||
{{#oneOf}}
|
||||
Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
|
||||
Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
|
||||
{{/composedSchemas.anyOf}}
|
||||
{{#composedSchemas.oneOf}}
|
||||
Utf8JsonReader {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader = reader;
|
||||
bool {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized = Client.ClientUtils.TryDeserialize<{{{dataType}}}>(ref {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader, options, out {{{dataType}}}{{^isBoolean}}{{nrt?}}{{/isBoolean}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}});
|
||||
|
||||
{{/oneOf}}
|
||||
{{#allOf}}
|
||||
Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
|
||||
Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
|
||||
{{/allOf}}
|
||||
{{/composedSchemas.oneOf}}
|
||||
{{#composedSchemas.allOf}}
|
||||
{{^isInherited}}
|
||||
Utf8JsonReader {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader = reader;
|
||||
bool {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized = Client.ClientUtils.TryDeserialize<{{{dataType}}}>(ref {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Reader, options, out {{{dataType}}}{{^isBoolean}}{{nrt?}}{{/isBoolean}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}});
|
||||
|
||||
{{/isInherited}}
|
||||
{{/composedSchemas.allOf}}
|
||||
{{#allVars}}
|
||||
{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default;
|
||||
{{/allVars}}
|
||||
@ -104,17 +107,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
{{#oneOf}}
|
||||
if ({{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} != null)
|
||||
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{#allOf}}{{#lambda.camelcase_param}}{{.}} {{/lambda.camelcase_param}}{{/allOf}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
|
||||
{{#composedSchemas.oneOf}}
|
||||
if ({{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}Deserialized)
|
||||
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}} {{#model.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/isInherited}}{{/model.composedSchemas.allOf}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
|
||||
|
||||
{{#-last}}
|
||||
throw new JsonException();
|
||||
{{/-last}}
|
||||
{{/oneOf}}
|
||||
{{^oneOf}}
|
||||
return new {{classname}}({{#lambda.joinWithComma}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
|
||||
{{/oneOf}}
|
||||
{{/composedSchemas.oneOf}}
|
||||
{{^composedSchemas.oneOf}}
|
||||
return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{#model.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}} {{/isInherited}}{{/model.composedSchemas.allOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
|
||||
{{/composedSchemas.oneOf}}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3,21 +3,23 @@
|
||||
/// </summary>
|
||||
{{>visibility}} partial class {{classname}} : {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}{{^parentModel}}, IValidatableObject{{/parentModel}}{{/validatable}}
|
||||
{
|
||||
{{#oneOf}}
|
||||
{{#composedSchemas.oneOf}}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
|
||||
{{#allOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
|
||||
{{/allOf}}
|
||||
{{#anyOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
|
||||
{{/anyOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{#isNullable}}{{nrt?}}{{/isNullable}}"></param>
|
||||
{{#composedSchemas.allOf}}
|
||||
{{^isInherited}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}"></param>
|
||||
{{/isInherited}}
|
||||
{{/composedSchemas.allOf}}
|
||||
{{#composedSchemas.anyOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{#isNullable}}{{nrt?}}{{/isNullable}}"></param>
|
||||
{{/composedSchemas.anyOf}}
|
||||
{{#allVars}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}">{{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
|
||||
{{/allVars}}
|
||||
public {{classname}}({{#lambda.joinWithComma}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{#allOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#anyOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
|
||||
public {{classname}}({{#lambda.joinWithComma}}{{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{#model.composedSchemas.allOf}}{{^isInherited}}{{{dataType}}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/isInherited}}{{/model.composedSchemas.allOf}}{{#model.composedSchemas.anyOf}}{{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{#model.allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/model.allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{#parentModel.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/isInherited}}{{/parentModel.composedSchemas.allOf}}{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{parent}}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
|
||||
{
|
||||
{{#allVars}}
|
||||
{{^isInherited}}
|
||||
@ -30,13 +32,13 @@
|
||||
{{/required}}
|
||||
{{/isInherited}}
|
||||
{{/allVars}}
|
||||
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
|
||||
{{#allOf}}
|
||||
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
|
||||
{{/allOf}}
|
||||
{{#anyOf}}
|
||||
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
|
||||
{{/anyOf}}
|
||||
{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
|
||||
{{#composedSchemas.allOf}}
|
||||
{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
|
||||
{{/composedSchemas.allOf}}
|
||||
{{#composedSchemas.anyOf}}
|
||||
{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
|
||||
{{/composedSchemas.anyOf}}
|
||||
{{#allVars}}
|
||||
{{^isInherited}}
|
||||
{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
@ -44,21 +46,23 @@
|
||||
{{/allVars}}
|
||||
}
|
||||
|
||||
{{/oneOf}}
|
||||
{{^oneOf}}
|
||||
{{/composedSchemas.oneOf}}
|
||||
{{^composedSchemas.oneOf}}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||
/// </summary>
|
||||
{{#allOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
|
||||
{{/allOf}}
|
||||
{{#anyOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
|
||||
{{/anyOf}}
|
||||
{{#composedSchemas.allOf}}
|
||||
{{^isInherited}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}"></param>
|
||||
{{/isInherited}}
|
||||
{{/composedSchemas.allOf}}
|
||||
{{#composedSchemas.anyOf}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}}{{#isNullable}}{{nrt?}}{{/isNullable}}"></param>
|
||||
{{/composedSchemas.anyOf}}
|
||||
{{#allVars}}
|
||||
/// <param name="{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}">{{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
|
||||
{{/allVars}}
|
||||
public {{classname}}({{#lambda.joinWithComma}}{{#allOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#anyOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
|
||||
public {{classname}}({{#lambda.joinWithComma}}{{#composedSchemas.allOf}}{{^isInherited}}{{{dataType}}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/isInherited}}{{/composedSchemas.allOf}}{{#composedSchemas.anyOf}}{{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}} {{/composedSchemas.anyOf}}{{#allVars}}{{^compulsory}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/compulsory}}{{#compulsory}}{{{datatypeWithEnum}}}{{/compulsory}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{^compulsory}} = default{{/compulsory}}{{/defaultValue}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{#parentModel.composedSchemas.allOf}}{{^isInherited}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/isInherited}}{{/parentModel.composedSchemas.allOf}}{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{parent}}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
|
||||
{
|
||||
{{#allVars}}
|
||||
{{^isInherited}}
|
||||
@ -71,12 +75,14 @@
|
||||
{{/required}}
|
||||
{{/isInherited}}
|
||||
{{/allVars}}
|
||||
{{#allOf}}
|
||||
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
|
||||
{{/allOf}}
|
||||
{{#anyOf}}
|
||||
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
|
||||
{{/anyOf}}
|
||||
{{#composedSchemas.allOf}}
|
||||
{{^isInherited}}
|
||||
{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.camelcase_param}};
|
||||
{{/isInherited}}
|
||||
{{/composedSchemas.allOf}}
|
||||
{{#composedSchemas.anyOf}}
|
||||
{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} = {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}};
|
||||
{{/composedSchemas.anyOf}}
|
||||
{{#allVars}}
|
||||
{{^isInherited}}
|
||||
{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
@ -84,7 +90,7 @@
|
||||
{{/allVars}}
|
||||
}
|
||||
|
||||
{{/oneOf}}
|
||||
{{/composedSchemas.oneOf}}
|
||||
{{#vars}}
|
||||
{{#items.isEnum}}
|
||||
{{#items}}
|
||||
@ -113,39 +119,41 @@
|
||||
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
{{#anyOf}}
|
||||
{{#composedSchemas.anyOf}}
|
||||
/// <summary>
|
||||
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
|
||||
/// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{.}}</value>{{/description}}
|
||||
{{#deprecated}}
|
||||
[Obsolete]
|
||||
{{/deprecated}}
|
||||
public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
public {{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
|
||||
{{/anyOf}}
|
||||
{{#oneOf}}
|
||||
{{/composedSchemas.anyOf}}
|
||||
{{#composedSchemas.oneOf}}
|
||||
/// <summary>
|
||||
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
|
||||
/// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{.}}</value>{{/description}}
|
||||
{{#deprecated}}
|
||||
[Obsolete]
|
||||
{{/deprecated}}
|
||||
public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
public {{{dataType}}}{{#isNullable}}{{nrt?}}{{/isNullable}} {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
|
||||
{{/oneOf}}
|
||||
{{#allOf}}
|
||||
{{/composedSchemas.oneOf}}
|
||||
{{#composedSchemas.allOf}}
|
||||
{{^isInherited}}
|
||||
/// <summary>
|
||||
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
|
||||
/// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{.}}</value>{{/description}}
|
||||
{{#deprecated}}
|
||||
[Obsolete]
|
||||
{{/deprecated}}
|
||||
public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
public {{{dataType}}} {{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
|
||||
{{/allOf}}
|
||||
{{/isInherited}}
|
||||
{{/composedSchemas.allOf}}
|
||||
{{#allVars}}
|
||||
{{^isInherited}}
|
||||
{{^isEnum}}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -69,6 +69,7 @@ docs/models/OuterEnumIntegerDefaultValue.md
|
||||
docs/models/ParentPet.md
|
||||
docs/models/Pet.md
|
||||
docs/models/Pig.md
|
||||
docs/models/PolymorphicProperty.md
|
||||
docs/models/Quadrilateral.md
|
||||
docs/models/QuadrilateralInterface.md
|
||||
docs/models/ReadOnlyFirst.md
|
||||
@ -174,6 +175,7 @@ src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
|
||||
src/Org.OpenAPITools/Model/ParentPet.cs
|
||||
src/Org.OpenAPITools/Model/Pet.cs
|
||||
src/Org.OpenAPITools/Model/Pig.cs
|
||||
src/Org.OpenAPITools/Model/PolymorphicProperty.cs
|
||||
src/Org.OpenAPITools/Model/Quadrilateral.cs
|
||||
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
|
||||
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Org.OpenAPITools.Model.PolymorphicProperty
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using Xunit;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Model;
|
||||
using Org.OpenAPITools.Client;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Org.OpenAPITools.Test.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for testing PolymorphicProperty
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
/// Please update the test case below to test the model.
|
||||
/// </remarks>
|
||||
public class PolymorphicPropertyTests : IDisposable
|
||||
{
|
||||
// TODO uncomment below to declare an instance variable for PolymorphicProperty
|
||||
//private PolymorphicProperty instance;
|
||||
|
||||
public PolymorphicPropertyTests()
|
||||
{
|
||||
// TODO uncomment below to create an instance of PolymorphicProperty
|
||||
//instance = new PolymorphicProperty();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Cleanup when everything is done.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of PolymorphicProperty
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void PolymorphicPropertyInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsType" PolymorphicProperty
|
||||
//Assert.IsType<PolymorphicProperty>(instance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -51,7 +51,9 @@ namespace Org.OpenAPITools.Client
|
||||
_jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
|
||||
_jsonOptions.Converters.Add(new MammalJsonConverter());
|
||||
_jsonOptions.Converters.Add(new NullableShapeJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ParentPetJsonConverter());
|
||||
_jsonOptions.Converters.Add(new PigJsonConverter());
|
||||
_jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter());
|
||||
_jsonOptions.Converters.Add(new QuadrilateralJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ShapeJsonConverter());
|
||||
|
@ -34,18 +34,25 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Cat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="catAllOf">catAllOf</param>
|
||||
/// <param name="dictionary"></param>
|
||||
/// <param name="catAllOf"></param>
|
||||
/// <param name="className">className (required)</param>
|
||||
/// <param name="color">color (default to "red")</param>
|
||||
public Cat(CatAllOf? catAllOf, string className, string? color = "red") : base(className, color)
|
||||
public Cat(Dictionary<string, int> dictionary, CatAllOf catAllOf, string className, string? color = "red") : base(className, color)
|
||||
{
|
||||
Dictionary = dictionary;
|
||||
CatAllOf = catAllOf;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Cat
|
||||
/// Gets or Sets Dictionary
|
||||
/// </summary>
|
||||
public CatAllOf? CatAllOf { get; set; }
|
||||
public Dictionary<string, int> Dictionary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets CatAllOf
|
||||
/// </summary>
|
||||
public CatAllOf CatAllOf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
@ -122,8 +129,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader dictionaryReader = reader;
|
||||
bool dictionaryDeserialized = Client.ClientUtils.TryDeserialize<Dictionary<string, int>>(ref dictionaryReader, options, out Dictionary<string, int>? dictionary);
|
||||
|
||||
Utf8JsonReader catAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf? catAllOf);
|
||||
bool catAllOfDeserialized = Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf? catAllOf);
|
||||
|
||||
string? className = default;
|
||||
string? color = default;
|
||||
|
||||
@ -149,7 +160,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new Cat(catAllOf, className, color);
|
||||
return new Cat(dictionary, catAllOf, className, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -34,17 +34,17 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="childCatAllOf">childCatAllOf</param>
|
||||
/// <param name="childCatAllOf"></param>
|
||||
/// <param name="petType">petType (required)</param>
|
||||
public ChildCat(ChildCatAllOf? childCatAllOf, string petType) : base(petType)
|
||||
public ChildCat(ChildCatAllOf childCatAllOf, string petType) : base(petType)
|
||||
{
|
||||
ChildCatAllOf = childCatAllOf;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ChildCat
|
||||
/// Gets or Sets ChildCatAllOf
|
||||
/// </summary>
|
||||
public ChildCatAllOf? ChildCatAllOf { get; set; }
|
||||
public ChildCatAllOf ChildCatAllOf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
@ -122,7 +122,8 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader childCatAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf? childCatAllOf);
|
||||
bool childCatAllOfDeserialized = Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf? childCatAllOf);
|
||||
|
||||
string? petType = default;
|
||||
|
||||
while (reader.Read())
|
||||
|
@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ComplexQuadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
public ComplexQuadrilateral(QuadrilateralInterface? quadrilateralInterface, ShapeInterface? shapeInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="quadrilateralInterface"></param>
|
||||
public ComplexQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
|
||||
{
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
ShapeInterface = shapeInterface;
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public QuadrilateralInterface? QuadrilateralInterface { get; set; }
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// Gets or Sets QuadrilateralInterface
|
||||
/// </summary>
|
||||
public ShapeInterface? ShapeInterface { get; set; }
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -146,10 +146,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
@ -167,7 +169,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new ComplexQuadrilateral(quadrilateralInterface, shapeInterface);
|
||||
return new ComplexQuadrilateral(shapeInterface, quadrilateralInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -34,18 +34,18 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Dog" /> class.
|
||||
/// </summary>
|
||||
/// <param name="dogAllOf">dogAllOf</param>
|
||||
/// <param name="dogAllOf"></param>
|
||||
/// <param name="className">className (required)</param>
|
||||
/// <param name="color">color (default to "red")</param>
|
||||
public Dog(DogAllOf? dogAllOf, string className, string? color = "red") : base(className, color)
|
||||
public Dog(DogAllOf dogAllOf, string className, string? color = "red") : base(className, color)
|
||||
{
|
||||
DogAllOf = dogAllOf;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Dog
|
||||
/// Gets or Sets DogAllOf
|
||||
/// </summary>
|
||||
public DogAllOf? DogAllOf { get; set; }
|
||||
public DogAllOf DogAllOf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
@ -123,7 +123,8 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader dogAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf? dogAllOf);
|
||||
bool dogAllOfDeserialized = Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf? dogAllOf);
|
||||
|
||||
string? className = default;
|
||||
string? color = default;
|
||||
|
||||
|
@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EquilateralTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
public EquilateralTriangle(ShapeInterface? shapeInterface, TriangleInterface? triangleInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public EquilateralTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
TriangleInterface = triangleInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface? ShapeInterface { get; set; }
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface? TriangleInterface { get; set; }
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -147,9 +147,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="apple">apple</param>
|
||||
/// <param name="apple?"></param>
|
||||
/// <param name="color">color</param>
|
||||
public Fruit(Apple? apple, string? color = default)
|
||||
{
|
||||
@ -45,23 +45,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="banana">banana</param>
|
||||
/// <param name="banana"></param>
|
||||
/// <param name="color">color</param>
|
||||
public Fruit(Banana? banana, string? color = default)
|
||||
public Fruit(Banana banana, string? color = default)
|
||||
{
|
||||
Banana = banana;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruit
|
||||
/// Gets or Sets Apple
|
||||
/// </summary>
|
||||
public Apple? Apple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruit
|
||||
/// Gets or Sets Banana
|
||||
/// </summary>
|
||||
public Banana? Banana { get; set; }
|
||||
public Banana Banana { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Color
|
||||
@ -158,10 +158,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple? apple);
|
||||
bool appleDeserialized = Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple? apple);
|
||||
|
||||
Utf8JsonReader bananaReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana? banana);
|
||||
bool bananaDeserialized = Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana? banana);
|
||||
|
||||
string? color = default;
|
||||
|
||||
@ -184,10 +184,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (apple != null)
|
||||
if (appleDeserialized)
|
||||
return new Fruit(apple, color);
|
||||
|
||||
if (banana != null)
|
||||
if (bananaDeserialized)
|
||||
return new Fruit(banana, color);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -34,8 +34,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FruitReq" /> class.
|
||||
/// </summary>
|
||||
/// <param name="appleReq">appleReq</param>
|
||||
public FruitReq(AppleReq? appleReq)
|
||||
/// <param name="appleReq"></param>
|
||||
public FruitReq(AppleReq appleReq)
|
||||
{
|
||||
AppleReq = appleReq;
|
||||
}
|
||||
@ -43,21 +43,21 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FruitReq" /> class.
|
||||
/// </summary>
|
||||
/// <param name="bananaReq">bananaReq</param>
|
||||
public FruitReq(BananaReq? bananaReq)
|
||||
/// <param name="bananaReq"></param>
|
||||
public FruitReq(BananaReq bananaReq)
|
||||
{
|
||||
BananaReq = bananaReq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruitReq
|
||||
/// Gets or Sets AppleReq
|
||||
/// </summary>
|
||||
public AppleReq? AppleReq { get; set; }
|
||||
public AppleReq AppleReq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruitReq
|
||||
/// Gets or Sets BananaReq
|
||||
/// </summary>
|
||||
public BananaReq? BananaReq { get; set; }
|
||||
public BananaReq BananaReq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
@ -143,10 +143,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReqReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<AppleReq>(ref appleReqReader, options, out AppleReq? appleReq);
|
||||
bool appleReqDeserialized = Client.ClientUtils.TryDeserialize<AppleReq>(ref appleReqReader, options, out AppleReq? appleReq);
|
||||
|
||||
Utf8JsonReader bananaReqReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<BananaReq>(ref bananaReqReader, options, out BananaReq? bananaReq);
|
||||
bool bananaReqDeserialized = Client.ClientUtils.TryDeserialize<BananaReq>(ref bananaReqReader, options, out BananaReq? bananaReq);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -165,10 +165,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (appleReq != null)
|
||||
if (appleReqDeserialized)
|
||||
return new FruitReq(appleReq);
|
||||
|
||||
if (bananaReq != null)
|
||||
if (bananaReqDeserialized)
|
||||
return new FruitReq(bananaReq);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -34,25 +34,25 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GmFruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="apple">apple</param>
|
||||
/// <param name="banana">banana</param>
|
||||
/// <param name="apple?"></param>
|
||||
/// <param name="banana"></param>
|
||||
/// <param name="color">color</param>
|
||||
public GmFruit(Apple? apple, Banana? banana, string? color = default)
|
||||
public GmFruit(Apple? apple, Banana banana, string? color = default)
|
||||
{
|
||||
Apple = apple;
|
||||
Banana = banana;
|
||||
Apple = Apple;
|
||||
Banana = Banana;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets gmFruit
|
||||
/// Gets or Sets Apple
|
||||
/// </summary>
|
||||
public Apple? Apple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets gmFruit
|
||||
/// Gets or Sets Banana
|
||||
/// </summary>
|
||||
public Banana? Banana { get; set; }
|
||||
public Banana Banana { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Color
|
||||
@ -149,10 +149,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple? apple);
|
||||
bool appleDeserialized = Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple? apple);
|
||||
|
||||
Utf8JsonReader bananaReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana? banana);
|
||||
bool bananaDeserialized = Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana? banana);
|
||||
|
||||
string? color = default;
|
||||
|
||||
|
@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IsoscelesTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
public IsoscelesTriangle(ShapeInterface? shapeInterface, TriangleInterface? triangleInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public IsoscelesTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
TriangleInterface = triangleInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface? ShapeInterface { get; set; }
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface? TriangleInterface { get; set; }
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
@ -136,9 +136,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -34,17 +34,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="pig">pig</param>
|
||||
public Mammal(Pig? pig)
|
||||
{
|
||||
Pig = pig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="whale">whale</param>
|
||||
public Mammal(Whale? whale)
|
||||
/// <param name="whale"></param>
|
||||
public Mammal(Whale whale)
|
||||
{
|
||||
Whale = whale;
|
||||
}
|
||||
@ -52,26 +43,35 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="zebra">zebra</param>
|
||||
public Mammal(Zebra? zebra)
|
||||
/// <param name="zebra"></param>
|
||||
public Mammal(Zebra zebra)
|
||||
{
|
||||
Zebra = zebra;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
public Pig? Pig { get; set; }
|
||||
/// <param name="pig"></param>
|
||||
public Mammal(Pig pig)
|
||||
{
|
||||
Pig = pig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Gets or Sets Whale
|
||||
/// </summary>
|
||||
public Whale? Whale { get; set; }
|
||||
public Whale Whale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Gets or Sets Zebra
|
||||
/// </summary>
|
||||
public Zebra? Zebra { get; set; }
|
||||
public Zebra Zebra { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// </summary>
|
||||
public Pig Pig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -177,14 +177,14 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader pigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Pig>(ref pigReader, options, out Pig? pig);
|
||||
|
||||
Utf8JsonReader whaleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Whale>(ref whaleReader, options, out Whale? whale);
|
||||
bool whaleDeserialized = Client.ClientUtils.TryDeserialize<Whale>(ref whaleReader, options, out Whale? whale);
|
||||
|
||||
Utf8JsonReader zebraReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Zebra>(ref zebraReader, options, out Zebra? zebra);
|
||||
bool zebraDeserialized = Client.ClientUtils.TryDeserialize<Zebra>(ref zebraReader, options, out Zebra? zebra);
|
||||
|
||||
Utf8JsonReader pigReader = reader;
|
||||
bool pigDeserialized = Client.ClientUtils.TryDeserialize<Pig>(ref pigReader, options, out Pig? pig);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -203,15 +203,15 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (pig != null)
|
||||
return new Mammal(pig);
|
||||
|
||||
if (whale != null)
|
||||
if (whaleDeserialized)
|
||||
return new Mammal(whale);
|
||||
|
||||
if (zebra != null)
|
||||
if (zebraDeserialized)
|
||||
return new Mammal(zebra);
|
||||
|
||||
if (pigDeserialized)
|
||||
return new Mammal(pig);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -34,32 +34,30 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
public NullableShape(Quadrilateral? quadrilateral)
|
||||
{
|
||||
Quadrilateral = quadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
public NullableShape(Triangle? triangle)
|
||||
/// <param name="triangle"></param>
|
||||
public NullableShape(Triangle triangle)
|
||||
{
|
||||
Triangle = triangle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.</value>
|
||||
public Quadrilateral? Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
public NullableShape(Quadrilateral quadrilateral)
|
||||
{
|
||||
Quadrilateral = quadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.</value>
|
||||
public Triangle? Triangle { get; set; }
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -165,11 +163,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle? triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle? triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -188,12 +186,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new NullableShape(quadrilateral);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new NullableShape(triangle);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new NullableShape(quadrilateral);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -87,4 +87,64 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json converter for type ParentPet
|
||||
/// </summary>
|
||||
public class ParentPetJsonConverter : JsonConverter<ParentPet>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a boolean if the type is compatible with this converter.
|
||||
/// </summary>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvert(Type typeToConvert) => typeof(ParentPet).IsAssignableFrom(typeToConvert);
|
||||
|
||||
/// <summary>
|
||||
/// A Json reader.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="JsonException"></exception>
|
||||
public override ParentPet Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int currentDepth = reader.CurrentDepth;
|
||||
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
string? petType = default;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
|
||||
break;
|
||||
|
||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||
{
|
||||
string? propertyName = reader.GetString();
|
||||
reader.Read();
|
||||
|
||||
switch (propertyName)
|
||||
{
|
||||
case "pet_type":
|
||||
petType = reader.GetString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ParentPet(petType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json writer
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="parentPet"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions options) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||
/// </summary>
|
||||
/// <param name="basquePig">basquePig</param>
|
||||
public Pig(BasquePig? basquePig)
|
||||
/// <param name="basquePig"></param>
|
||||
public Pig(BasquePig basquePig)
|
||||
{
|
||||
BasquePig = basquePig;
|
||||
}
|
||||
@ -43,21 +43,21 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||
/// </summary>
|
||||
/// <param name="danishPig">danishPig</param>
|
||||
public Pig(DanishPig? danishPig)
|
||||
/// <param name="danishPig"></param>
|
||||
public Pig(DanishPig danishPig)
|
||||
{
|
||||
DanishPig = danishPig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// Gets or Sets BasquePig
|
||||
/// </summary>
|
||||
public BasquePig? BasquePig { get; set; }
|
||||
public BasquePig BasquePig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// Gets or Sets DanishPig
|
||||
/// </summary>
|
||||
public DanishPig? DanishPig { get; set; }
|
||||
public DanishPig DanishPig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -164,10 +164,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader basquePigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<BasquePig>(ref basquePigReader, options, out BasquePig? basquePig);
|
||||
bool basquePigDeserialized = Client.ClientUtils.TryDeserialize<BasquePig>(ref basquePigReader, options, out BasquePig? basquePig);
|
||||
|
||||
Utf8JsonReader danishPigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<DanishPig>(ref danishPigReader, options, out DanishPig? danishPig);
|
||||
bool danishPigDeserialized = Client.ClientUtils.TryDeserialize<DanishPig>(ref danishPigReader, options, out DanishPig? danishPig);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -186,10 +186,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (basquePig != null)
|
||||
if (basquePigDeserialized)
|
||||
return new Pig(basquePig);
|
||||
|
||||
if (danishPig != null)
|
||||
if (danishPigDeserialized)
|
||||
return new Pig(danishPig);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -0,0 +1,237 @@
|
||||
// <auto-generated>
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// PolymorphicProperty
|
||||
/// </summary>
|
||||
public partial class PolymorphicProperty : IEquatable<PolymorphicProperty>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_bool"></param>
|
||||
public PolymorphicProperty(bool _bool)
|
||||
{
|
||||
Bool = _bool;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_string"></param>
|
||||
public PolymorphicProperty(string _string)
|
||||
{
|
||||
String = _string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_object"></param>
|
||||
public PolymorphicProperty(Object _object)
|
||||
{
|
||||
Object = _object;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="liststring"></param>
|
||||
public PolymorphicProperty(List<string> liststring)
|
||||
{
|
||||
Liststring = liststring;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Bool
|
||||
/// </summary>
|
||||
public bool Bool { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets String
|
||||
/// </summary>
|
||||
public string String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Object
|
||||
/// </summary>
|
||||
public Object Object { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Liststring
|
||||
/// </summary>
|
||||
public List<string> Liststring { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class PolymorphicProperty {\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object? input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input as PolymorphicProperty).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if PolymorphicProperty instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of PolymorphicProperty to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(PolymorphicProperty? input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hashCode = 41;
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json converter for type PolymorphicProperty
|
||||
/// </summary>
|
||||
public class PolymorphicPropertyJsonConverter : JsonConverter<PolymorphicProperty>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a boolean if the type is compatible with this converter.
|
||||
/// </summary>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvert(Type typeToConvert) => typeof(PolymorphicProperty).IsAssignableFrom(typeToConvert);
|
||||
|
||||
/// <summary>
|
||||
/// A Json reader.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="JsonException"></exception>
|
||||
public override PolymorphicProperty Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int currentDepth = reader.CurrentDepth;
|
||||
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader _boolReader = reader;
|
||||
bool _boolDeserialized = Client.ClientUtils.TryDeserialize<bool>(ref _boolReader, options, out bool _bool);
|
||||
|
||||
Utf8JsonReader _stringReader = reader;
|
||||
bool _stringDeserialized = Client.ClientUtils.TryDeserialize<string>(ref _stringReader, options, out string? _string);
|
||||
|
||||
Utf8JsonReader _objectReader = reader;
|
||||
bool _objectDeserialized = Client.ClientUtils.TryDeserialize<Object>(ref _objectReader, options, out Object? _object);
|
||||
|
||||
Utf8JsonReader liststringReader = reader;
|
||||
bool liststringDeserialized = Client.ClientUtils.TryDeserialize<List<string>>(ref liststringReader, options, out List<string>? liststring);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
|
||||
break;
|
||||
|
||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||
{
|
||||
string? propertyName = reader.GetString();
|
||||
reader.Read();
|
||||
|
||||
switch (propertyName)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_boolDeserialized)
|
||||
return new PolymorphicProperty(_bool);
|
||||
|
||||
if (_stringDeserialized)
|
||||
return new PolymorphicProperty(_string);
|
||||
|
||||
if (_objectDeserialized)
|
||||
return new PolymorphicProperty(_object);
|
||||
|
||||
if (liststringDeserialized)
|
||||
return new PolymorphicProperty(liststring);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json writer
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="polymorphicProperty"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions options) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -34,30 +34,30 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="complexQuadrilateral">complexQuadrilateral</param>
|
||||
public Quadrilateral(ComplexQuadrilateral? complexQuadrilateral)
|
||||
{
|
||||
ComplexQuadrilateral = complexQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="simpleQuadrilateral">simpleQuadrilateral</param>
|
||||
public Quadrilateral(SimpleQuadrilateral? simpleQuadrilateral)
|
||||
/// <param name="simpleQuadrilateral"></param>
|
||||
public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral)
|
||||
{
|
||||
SimpleQuadrilateral = simpleQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
public ComplexQuadrilateral? ComplexQuadrilateral { get; set; }
|
||||
/// <param name="complexQuadrilateral"></param>
|
||||
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral)
|
||||
{
|
||||
ComplexQuadrilateral = complexQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// </summary>
|
||||
public SimpleQuadrilateral? SimpleQuadrilateral { get; set; }
|
||||
public SimpleQuadrilateral SimpleQuadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// </summary>
|
||||
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -163,11 +163,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader complexQuadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ComplexQuadrilateral>(ref complexQuadrilateralReader, options, out ComplexQuadrilateral? complexQuadrilateral);
|
||||
|
||||
Utf8JsonReader simpleQuadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<SimpleQuadrilateral>(ref simpleQuadrilateralReader, options, out SimpleQuadrilateral? simpleQuadrilateral);
|
||||
bool simpleQuadrilateralDeserialized = Client.ClientUtils.TryDeserialize<SimpleQuadrilateral>(ref simpleQuadrilateralReader, options, out SimpleQuadrilateral? simpleQuadrilateral);
|
||||
|
||||
Utf8JsonReader complexQuadrilateralReader = reader;
|
||||
bool complexQuadrilateralDeserialized = Client.ClientUtils.TryDeserialize<ComplexQuadrilateral>(ref complexQuadrilateralReader, options, out ComplexQuadrilateral? complexQuadrilateral);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -186,12 +186,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (complexQuadrilateral != null)
|
||||
return new Quadrilateral(complexQuadrilateral);
|
||||
|
||||
if (simpleQuadrilateral != null)
|
||||
if (simpleQuadrilateralDeserialized)
|
||||
return new Quadrilateral(simpleQuadrilateral);
|
||||
|
||||
if (complexQuadrilateralDeserialized)
|
||||
return new Quadrilateral(complexQuadrilateral);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScaleneTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
public ScaleneTriangle(ShapeInterface? shapeInterface, TriangleInterface? triangleInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public ScaleneTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
TriangleInterface = triangleInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface? ShapeInterface { get; set; }
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface? TriangleInterface { get; set; }
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -147,9 +147,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface? triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -34,23 +34,9 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
/// <param name="triangle"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Quadrilateral? quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Triangle? triangle, string quadrilateralType)
|
||||
public Shape(Triangle triangle, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
@ -60,14 +46,28 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shape
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
public Quadrilateral? Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shape
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
public Triangle? Triangle { get; set; }
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
@ -184,11 +184,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle? triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle? triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
|
||||
|
||||
string? quadrilateralType = default;
|
||||
|
||||
@ -211,12 +211,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new Shape(quadrilateral, quadrilateralType);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new Shape(triangle, quadrilateralType);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new Shape(quadrilateral, quadrilateralType);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -34,23 +34,9 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
/// <param name="triangle"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Quadrilateral? quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Triangle? triangle, string quadrilateralType)
|
||||
public ShapeOrNull(Triangle triangle, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
@ -60,16 +46,28 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.</value>
|
||||
public Quadrilateral? Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.</value>
|
||||
public Triangle? Triangle { get; set; }
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
@ -186,11 +184,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle? triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle? triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral? quadrilateral);
|
||||
|
||||
string? quadrilateralType = default;
|
||||
|
||||
@ -213,12 +211,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new ShapeOrNull(quadrilateral, quadrilateralType);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new ShapeOrNull(triangle, quadrilateralType);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new ShapeOrNull(quadrilateral, quadrilateralType);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -34,23 +34,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SimpleQuadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
public SimpleQuadrilateral(QuadrilateralInterface? quadrilateralInterface, ShapeInterface? shapeInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="quadrilateralInterface"></param>
|
||||
public SimpleQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
|
||||
{
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
ShapeInterface = shapeInterface;
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public QuadrilateralInterface? QuadrilateralInterface { get; set; }
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// Gets or Sets QuadrilateralInterface
|
||||
/// </summary>
|
||||
public ShapeInterface? ShapeInterface { get; set; }
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -146,10 +146,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
@ -167,7 +169,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new SimpleQuadrilateral(quadrilateralInterface, shapeInterface);
|
||||
return new SimpleQuadrilateral(shapeInterface, quadrilateralInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -34,10 +34,10 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="equilateralTriangle">equilateralTriangle</param>
|
||||
/// <param name="equilateralTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(EquilateralTriangle? equilateralTriangle, string shapeType, string triangleType)
|
||||
public Triangle(EquilateralTriangle equilateralTriangle, string shapeType, string triangleType)
|
||||
{
|
||||
if (shapeType == null)
|
||||
throw new ArgumentNullException("shapeType is a required property for Triangle and cannot be null.");
|
||||
@ -53,10 +53,10 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="isoscelesTriangle">isoscelesTriangle</param>
|
||||
/// <param name="isoscelesTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(IsoscelesTriangle? isoscelesTriangle, string shapeType, string triangleType)
|
||||
public Triangle(IsoscelesTriangle isoscelesTriangle, string shapeType, string triangleType)
|
||||
{
|
||||
if (shapeType == null)
|
||||
throw new ArgumentNullException("shapeType is a required property for Triangle and cannot be null.");
|
||||
@ -72,10 +72,10 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="scaleneTriangle">scaleneTriangle</param>
|
||||
/// <param name="scaleneTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(ScaleneTriangle? scaleneTriangle, string shapeType, string triangleType)
|
||||
public Triangle(ScaleneTriangle scaleneTriangle, string shapeType, string triangleType)
|
||||
{
|
||||
if (shapeType == null)
|
||||
throw new ArgumentNullException("shapeType is a required property for Triangle and cannot be null.");
|
||||
@ -89,19 +89,19 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// </summary>
|
||||
public EquilateralTriangle? EquilateralTriangle { get; set; }
|
||||
public EquilateralTriangle EquilateralTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// </summary>
|
||||
public IsoscelesTriangle? IsoscelesTriangle { get; set; }
|
||||
public IsoscelesTriangle IsoscelesTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// </summary>
|
||||
public ScaleneTriangle? ScaleneTriangle { get; set; }
|
||||
public ScaleneTriangle ScaleneTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
@ -230,13 +230,13 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader equilateralTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<EquilateralTriangle>(ref equilateralTriangleReader, options, out EquilateralTriangle? equilateralTriangle);
|
||||
bool equilateralTriangleDeserialized = Client.ClientUtils.TryDeserialize<EquilateralTriangle>(ref equilateralTriangleReader, options, out EquilateralTriangle? equilateralTriangle);
|
||||
|
||||
Utf8JsonReader isoscelesTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<IsoscelesTriangle>(ref isoscelesTriangleReader, options, out IsoscelesTriangle? isoscelesTriangle);
|
||||
bool isoscelesTriangleDeserialized = Client.ClientUtils.TryDeserialize<IsoscelesTriangle>(ref isoscelesTriangleReader, options, out IsoscelesTriangle? isoscelesTriangle);
|
||||
|
||||
Utf8JsonReader scaleneTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ScaleneTriangle>(ref scaleneTriangleReader, options, out ScaleneTriangle? scaleneTriangle);
|
||||
bool scaleneTriangleDeserialized = Client.ClientUtils.TryDeserialize<ScaleneTriangle>(ref scaleneTriangleReader, options, out ScaleneTriangle? scaleneTriangle);
|
||||
|
||||
string? shapeType = default;
|
||||
string? triangleType = default;
|
||||
@ -263,13 +263,13 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (equilateralTriangle != null)
|
||||
if (equilateralTriangleDeserialized)
|
||||
return new Triangle(equilateralTriangle, shapeType, triangleType);
|
||||
|
||||
if (isoscelesTriangle != null)
|
||||
if (isoscelesTriangleDeserialized)
|
||||
return new Triangle(isoscelesTriangle, shapeType, triangleType);
|
||||
|
||||
if (scaleneTriangle != null)
|
||||
if (scaleneTriangleDeserialized)
|
||||
return new Triangle(scaleneTriangle, shapeType, triangleType);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -69,6 +69,7 @@ docs/models/OuterEnumIntegerDefaultValue.md
|
||||
docs/models/ParentPet.md
|
||||
docs/models/Pet.md
|
||||
docs/models/Pig.md
|
||||
docs/models/PolymorphicProperty.md
|
||||
docs/models/Quadrilateral.md
|
||||
docs/models/QuadrilateralInterface.md
|
||||
docs/models/ReadOnlyFirst.md
|
||||
@ -174,6 +175,7 @@ src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
|
||||
src/Org.OpenAPITools/Model/ParentPet.cs
|
||||
src/Org.OpenAPITools/Model/Pet.cs
|
||||
src/Org.OpenAPITools/Model/Pig.cs
|
||||
src/Org.OpenAPITools/Model/PolymorphicProperty.cs
|
||||
src/Org.OpenAPITools/Model/Quadrilateral.cs
|
||||
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
|
||||
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Org.OpenAPITools.Model.PolymorphicProperty
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using Xunit;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Model;
|
||||
using Org.OpenAPITools.Client;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Org.OpenAPITools.Test.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for testing PolymorphicProperty
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
/// Please update the test case below to test the model.
|
||||
/// </remarks>
|
||||
public class PolymorphicPropertyTests : IDisposable
|
||||
{
|
||||
// TODO uncomment below to declare an instance variable for PolymorphicProperty
|
||||
//private PolymorphicProperty instance;
|
||||
|
||||
public PolymorphicPropertyTests()
|
||||
{
|
||||
// TODO uncomment below to create an instance of PolymorphicProperty
|
||||
//instance = new PolymorphicProperty();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Cleanup when everything is done.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of PolymorphicProperty
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void PolymorphicPropertyInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsType" PolymorphicProperty
|
||||
//Assert.IsType<PolymorphicProperty>(instance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -49,7 +49,9 @@ namespace Org.OpenAPITools.Client
|
||||
_jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
|
||||
_jsonOptions.Converters.Add(new MammalJsonConverter());
|
||||
_jsonOptions.Converters.Add(new NullableShapeJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ParentPetJsonConverter());
|
||||
_jsonOptions.Converters.Add(new PigJsonConverter());
|
||||
_jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter());
|
||||
_jsonOptions.Converters.Add(new QuadrilateralJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ShapeJsonConverter());
|
||||
|
@ -32,16 +32,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Cat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="catAllOf">catAllOf</param>
|
||||
/// <param name="dictionary"></param>
|
||||
/// <param name="catAllOf"></param>
|
||||
/// <param name="className">className (required)</param>
|
||||
/// <param name="color">color (default to "red")</param>
|
||||
public Cat(CatAllOf catAllOf, string className, string color = "red") : base(className, color)
|
||||
public Cat(Dictionary<string, int> dictionary, CatAllOf catAllOf, string className, string color = "red") : base(className, color)
|
||||
{
|
||||
Dictionary = dictionary;
|
||||
CatAllOf = catAllOf;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Cat
|
||||
/// Gets or Sets Dictionary
|
||||
/// </summary>
|
||||
public Dictionary<string, int> Dictionary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets CatAllOf
|
||||
/// </summary>
|
||||
public CatAllOf CatAllOf { get; set; }
|
||||
|
||||
@ -120,8 +127,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader dictionaryReader = reader;
|
||||
bool dictionaryDeserialized = Client.ClientUtils.TryDeserialize<Dictionary<string, int>>(ref dictionaryReader, options, out Dictionary<string, int> dictionary);
|
||||
|
||||
Utf8JsonReader catAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf catAllOf);
|
||||
bool catAllOfDeserialized = Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf catAllOf);
|
||||
|
||||
string className = default;
|
||||
string color = default;
|
||||
|
||||
@ -147,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new Cat(catAllOf, className, color);
|
||||
return new Cat(dictionary, catAllOf, className, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="childCatAllOf">childCatAllOf</param>
|
||||
/// <param name="childCatAllOf"></param>
|
||||
/// <param name="petType">petType (required)</param>
|
||||
public ChildCat(ChildCatAllOf childCatAllOf, string petType) : base(petType)
|
||||
{
|
||||
@ -40,7 +40,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ChildCat
|
||||
/// Gets or Sets ChildCatAllOf
|
||||
/// </summary>
|
||||
public ChildCatAllOf ChildCatAllOf { get; set; }
|
||||
|
||||
@ -120,7 +120,8 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader childCatAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf childCatAllOf);
|
||||
bool childCatAllOfDeserialized = Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf childCatAllOf);
|
||||
|
||||
string petType = default;
|
||||
|
||||
while (reader.Read())
|
||||
|
@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ComplexQuadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
public ComplexQuadrilateral(QuadrilateralInterface quadrilateralInterface, ShapeInterface shapeInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="quadrilateralInterface"></param>
|
||||
public ComplexQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
|
||||
{
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
ShapeInterface = shapeInterface;
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralInterface
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -144,10 +144,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
@ -165,7 +167,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new ComplexQuadrilateral(quadrilateralInterface, shapeInterface);
|
||||
return new ComplexQuadrilateral(shapeInterface, quadrilateralInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Dog" /> class.
|
||||
/// </summary>
|
||||
/// <param name="dogAllOf">dogAllOf</param>
|
||||
/// <param name="dogAllOf"></param>
|
||||
/// <param name="className">className (required)</param>
|
||||
/// <param name="color">color (default to "red")</param>
|
||||
public Dog(DogAllOf dogAllOf, string className, string color = "red") : base(className, color)
|
||||
@ -41,7 +41,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Dog
|
||||
/// Gets or Sets DogAllOf
|
||||
/// </summary>
|
||||
public DogAllOf DogAllOf { get; set; }
|
||||
|
||||
@ -121,7 +121,8 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader dogAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf dogAllOf);
|
||||
bool dogAllOfDeserialized = Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf dogAllOf);
|
||||
|
||||
string className = default;
|
||||
string color = default;
|
||||
|
||||
|
@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EquilateralTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public EquilateralTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
@ -41,12 +41,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
@ -145,9 +145,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="apple">apple</param>
|
||||
/// <param name="apple"></param>
|
||||
/// <param name="color">color</param>
|
||||
public Fruit(Apple apple, string color = default)
|
||||
{
|
||||
@ -43,7 +43,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="banana">banana</param>
|
||||
/// <param name="banana"></param>
|
||||
/// <param name="color">color</param>
|
||||
public Fruit(Banana banana, string color = default)
|
||||
{
|
||||
@ -52,12 +52,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruit
|
||||
/// Gets or Sets Apple
|
||||
/// </summary>
|
||||
public Apple Apple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruit
|
||||
/// Gets or Sets Banana
|
||||
/// </summary>
|
||||
public Banana Banana { get; set; }
|
||||
|
||||
@ -156,10 +156,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
bool appleDeserialized = Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
|
||||
Utf8JsonReader bananaReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
bool bananaDeserialized = Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
|
||||
string color = default;
|
||||
|
||||
@ -182,10 +182,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (apple != null)
|
||||
if (appleDeserialized)
|
||||
return new Fruit(apple, color);
|
||||
|
||||
if (banana != null)
|
||||
if (bananaDeserialized)
|
||||
return new Fruit(banana, color);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FruitReq" /> class.
|
||||
/// </summary>
|
||||
/// <param name="appleReq">appleReq</param>
|
||||
/// <param name="appleReq"></param>
|
||||
public FruitReq(AppleReq appleReq)
|
||||
{
|
||||
AppleReq = appleReq;
|
||||
@ -41,19 +41,19 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FruitReq" /> class.
|
||||
/// </summary>
|
||||
/// <param name="bananaReq">bananaReq</param>
|
||||
/// <param name="bananaReq"></param>
|
||||
public FruitReq(BananaReq bananaReq)
|
||||
{
|
||||
BananaReq = bananaReq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruitReq
|
||||
/// Gets or Sets AppleReq
|
||||
/// </summary>
|
||||
public AppleReq AppleReq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruitReq
|
||||
/// Gets or Sets BananaReq
|
||||
/// </summary>
|
||||
public BananaReq BananaReq { get; set; }
|
||||
|
||||
@ -141,10 +141,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReqReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<AppleReq>(ref appleReqReader, options, out AppleReq appleReq);
|
||||
bool appleReqDeserialized = Client.ClientUtils.TryDeserialize<AppleReq>(ref appleReqReader, options, out AppleReq appleReq);
|
||||
|
||||
Utf8JsonReader bananaReqReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<BananaReq>(ref bananaReqReader, options, out BananaReq bananaReq);
|
||||
bool bananaReqDeserialized = Client.ClientUtils.TryDeserialize<BananaReq>(ref bananaReqReader, options, out BananaReq bananaReq);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -163,10 +163,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (appleReq != null)
|
||||
if (appleReqDeserialized)
|
||||
return new FruitReq(appleReq);
|
||||
|
||||
if (bananaReq != null)
|
||||
if (bananaReqDeserialized)
|
||||
return new FruitReq(bananaReq);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -32,23 +32,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GmFruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="apple">apple</param>
|
||||
/// <param name="banana">banana</param>
|
||||
/// <param name="apple"></param>
|
||||
/// <param name="banana"></param>
|
||||
/// <param name="color">color</param>
|
||||
public GmFruit(Apple apple, Banana banana, string color = default)
|
||||
{
|
||||
Apple = apple;
|
||||
Banana = banana;
|
||||
Apple = Apple;
|
||||
Banana = Banana;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets gmFruit
|
||||
/// Gets or Sets Apple
|
||||
/// </summary>
|
||||
public Apple Apple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets gmFruit
|
||||
/// Gets or Sets Banana
|
||||
/// </summary>
|
||||
public Banana Banana { get; set; }
|
||||
|
||||
@ -147,10 +147,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
bool appleDeserialized = Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
|
||||
Utf8JsonReader bananaReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
bool bananaDeserialized = Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
|
||||
string color = default;
|
||||
|
||||
|
@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IsoscelesTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public IsoscelesTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
@ -41,12 +41,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
@ -134,9 +134,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -32,16 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="pig">pig</param>
|
||||
public Mammal(Pig pig)
|
||||
{
|
||||
Pig = pig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="whale">whale</param>
|
||||
/// <param name="whale"></param>
|
||||
public Mammal(Whale whale)
|
||||
{
|
||||
Whale = whale;
|
||||
@ -50,27 +41,36 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="zebra">zebra</param>
|
||||
/// <param name="zebra"></param>
|
||||
public Mammal(Zebra zebra)
|
||||
{
|
||||
Zebra = zebra;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
public Pig Pig { get; set; }
|
||||
/// <param name="pig"></param>
|
||||
public Mammal(Pig pig)
|
||||
{
|
||||
Pig = pig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Gets or Sets Whale
|
||||
/// </summary>
|
||||
public Whale Whale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Gets or Sets Zebra
|
||||
/// </summary>
|
||||
public Zebra Zebra { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// </summary>
|
||||
public Pig Pig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -175,14 +175,14 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader pigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Pig>(ref pigReader, options, out Pig pig);
|
||||
|
||||
Utf8JsonReader whaleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Whale>(ref whaleReader, options, out Whale whale);
|
||||
bool whaleDeserialized = Client.ClientUtils.TryDeserialize<Whale>(ref whaleReader, options, out Whale whale);
|
||||
|
||||
Utf8JsonReader zebraReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Zebra>(ref zebraReader, options, out Zebra zebra);
|
||||
bool zebraDeserialized = Client.ClientUtils.TryDeserialize<Zebra>(ref zebraReader, options, out Zebra zebra);
|
||||
|
||||
Utf8JsonReader pigReader = reader;
|
||||
bool pigDeserialized = Client.ClientUtils.TryDeserialize<Pig>(ref pigReader, options, out Pig pig);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -201,15 +201,15 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (pig != null)
|
||||
return new Mammal(pig);
|
||||
|
||||
if (whale != null)
|
||||
if (whaleDeserialized)
|
||||
return new Mammal(whale);
|
||||
|
||||
if (zebra != null)
|
||||
if (zebraDeserialized)
|
||||
return new Mammal(zebra);
|
||||
|
||||
if (pigDeserialized)
|
||||
return new Mammal(pig);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,33 +32,31 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
public NullableShape(Quadrilateral quadrilateral)
|
||||
{
|
||||
Quadrilateral = quadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="triangle"></param>
|
||||
public NullableShape(Triangle triangle)
|
||||
{
|
||||
Triangle = triangle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.</value>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
public NullableShape(Quadrilateral quadrilateral)
|
||||
{
|
||||
Quadrilateral = quadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.</value>
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -163,11 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -186,12 +184,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new NullableShape(quadrilateral);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new NullableShape(triangle);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new NullableShape(quadrilateral);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -85,4 +85,64 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json converter for type ParentPet
|
||||
/// </summary>
|
||||
public class ParentPetJsonConverter : JsonConverter<ParentPet>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a boolean if the type is compatible with this converter.
|
||||
/// </summary>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvert(Type typeToConvert) => typeof(ParentPet).IsAssignableFrom(typeToConvert);
|
||||
|
||||
/// <summary>
|
||||
/// A Json reader.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="JsonException"></exception>
|
||||
public override ParentPet Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int currentDepth = reader.CurrentDepth;
|
||||
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
string petType = default;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
|
||||
break;
|
||||
|
||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||
{
|
||||
string propertyName = reader.GetString();
|
||||
reader.Read();
|
||||
|
||||
switch (propertyName)
|
||||
{
|
||||
case "pet_type":
|
||||
petType = reader.GetString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ParentPet(petType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json writer
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="parentPet"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions options) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||
/// </summary>
|
||||
/// <param name="basquePig">basquePig</param>
|
||||
/// <param name="basquePig"></param>
|
||||
public Pig(BasquePig basquePig)
|
||||
{
|
||||
BasquePig = basquePig;
|
||||
@ -41,19 +41,19 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||
/// </summary>
|
||||
/// <param name="danishPig">danishPig</param>
|
||||
/// <param name="danishPig"></param>
|
||||
public Pig(DanishPig danishPig)
|
||||
{
|
||||
DanishPig = danishPig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// Gets or Sets BasquePig
|
||||
/// </summary>
|
||||
public BasquePig BasquePig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// Gets or Sets DanishPig
|
||||
/// </summary>
|
||||
public DanishPig DanishPig { get; set; }
|
||||
|
||||
@ -162,10 +162,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader basquePigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<BasquePig>(ref basquePigReader, options, out BasquePig basquePig);
|
||||
bool basquePigDeserialized = Client.ClientUtils.TryDeserialize<BasquePig>(ref basquePigReader, options, out BasquePig basquePig);
|
||||
|
||||
Utf8JsonReader danishPigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<DanishPig>(ref danishPigReader, options, out DanishPig danishPig);
|
||||
bool danishPigDeserialized = Client.ClientUtils.TryDeserialize<DanishPig>(ref danishPigReader, options, out DanishPig danishPig);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -184,10 +184,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (basquePig != null)
|
||||
if (basquePigDeserialized)
|
||||
return new Pig(basquePig);
|
||||
|
||||
if (danishPig != null)
|
||||
if (danishPigDeserialized)
|
||||
return new Pig(danishPig);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -0,0 +1,235 @@
|
||||
// <auto-generated>
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// PolymorphicProperty
|
||||
/// </summary>
|
||||
public partial class PolymorphicProperty : IEquatable<PolymorphicProperty>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_bool"></param>
|
||||
public PolymorphicProperty(bool _bool)
|
||||
{
|
||||
Bool = _bool;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_string"></param>
|
||||
public PolymorphicProperty(string _string)
|
||||
{
|
||||
String = _string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_object"></param>
|
||||
public PolymorphicProperty(Object _object)
|
||||
{
|
||||
Object = _object;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="liststring"></param>
|
||||
public PolymorphicProperty(List<string> liststring)
|
||||
{
|
||||
Liststring = liststring;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Bool
|
||||
/// </summary>
|
||||
public bool Bool { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets String
|
||||
/// </summary>
|
||||
public string String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Object
|
||||
/// </summary>
|
||||
public Object Object { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Liststring
|
||||
/// </summary>
|
||||
public List<string> Liststring { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class PolymorphicProperty {\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input as PolymorphicProperty).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if PolymorphicProperty instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of PolymorphicProperty to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(PolymorphicProperty input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hashCode = 41;
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json converter for type PolymorphicProperty
|
||||
/// </summary>
|
||||
public class PolymorphicPropertyJsonConverter : JsonConverter<PolymorphicProperty>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a boolean if the type is compatible with this converter.
|
||||
/// </summary>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvert(Type typeToConvert) => typeof(PolymorphicProperty).IsAssignableFrom(typeToConvert);
|
||||
|
||||
/// <summary>
|
||||
/// A Json reader.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="JsonException"></exception>
|
||||
public override PolymorphicProperty Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int currentDepth = reader.CurrentDepth;
|
||||
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader _boolReader = reader;
|
||||
bool _boolDeserialized = Client.ClientUtils.TryDeserialize<bool>(ref _boolReader, options, out bool _bool);
|
||||
|
||||
Utf8JsonReader _stringReader = reader;
|
||||
bool _stringDeserialized = Client.ClientUtils.TryDeserialize<string>(ref _stringReader, options, out string _string);
|
||||
|
||||
Utf8JsonReader _objectReader = reader;
|
||||
bool _objectDeserialized = Client.ClientUtils.TryDeserialize<Object>(ref _objectReader, options, out Object _object);
|
||||
|
||||
Utf8JsonReader liststringReader = reader;
|
||||
bool liststringDeserialized = Client.ClientUtils.TryDeserialize<List<string>>(ref liststringReader, options, out List<string> liststring);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
|
||||
break;
|
||||
|
||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||
{
|
||||
string propertyName = reader.GetString();
|
||||
reader.Read();
|
||||
|
||||
switch (propertyName)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_boolDeserialized)
|
||||
return new PolymorphicProperty(_bool);
|
||||
|
||||
if (_stringDeserialized)
|
||||
return new PolymorphicProperty(_string);
|
||||
|
||||
if (_objectDeserialized)
|
||||
return new PolymorphicProperty(_object);
|
||||
|
||||
if (liststringDeserialized)
|
||||
return new PolymorphicProperty(liststring);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json writer
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="polymorphicProperty"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions options) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -32,31 +32,31 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="complexQuadrilateral">complexQuadrilateral</param>
|
||||
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral)
|
||||
{
|
||||
ComplexQuadrilateral = complexQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="simpleQuadrilateral">simpleQuadrilateral</param>
|
||||
/// <param name="simpleQuadrilateral"></param>
|
||||
public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral)
|
||||
{
|
||||
SimpleQuadrilateral = simpleQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
||||
/// <param name="complexQuadrilateral"></param>
|
||||
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral)
|
||||
{
|
||||
ComplexQuadrilateral = complexQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// </summary>
|
||||
public SimpleQuadrilateral SimpleQuadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// </summary>
|
||||
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -161,11 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader complexQuadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ComplexQuadrilateral>(ref complexQuadrilateralReader, options, out ComplexQuadrilateral complexQuadrilateral);
|
||||
|
||||
Utf8JsonReader simpleQuadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<SimpleQuadrilateral>(ref simpleQuadrilateralReader, options, out SimpleQuadrilateral simpleQuadrilateral);
|
||||
bool simpleQuadrilateralDeserialized = Client.ClientUtils.TryDeserialize<SimpleQuadrilateral>(ref simpleQuadrilateralReader, options, out SimpleQuadrilateral simpleQuadrilateral);
|
||||
|
||||
Utf8JsonReader complexQuadrilateralReader = reader;
|
||||
bool complexQuadrilateralDeserialized = Client.ClientUtils.TryDeserialize<ComplexQuadrilateral>(ref complexQuadrilateralReader, options, out ComplexQuadrilateral complexQuadrilateral);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -184,12 +184,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (complexQuadrilateral != null)
|
||||
return new Quadrilateral(complexQuadrilateral);
|
||||
|
||||
if (simpleQuadrilateral != null)
|
||||
if (simpleQuadrilateralDeserialized)
|
||||
return new Quadrilateral(simpleQuadrilateral);
|
||||
|
||||
if (complexQuadrilateralDeserialized)
|
||||
return new Quadrilateral(complexQuadrilateral);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScaleneTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public ScaleneTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
@ -41,12 +41,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
@ -145,9 +145,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -32,21 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="triangle"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Triangle triangle, string quadrilateralType)
|
||||
{
|
||||
@ -58,15 +44,29 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shape
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shape
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
@ -182,11 +182,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
string quadrilateralType = default;
|
||||
|
||||
@ -209,12 +209,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new Shape(quadrilateral, quadrilateralType);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new Shape(triangle, quadrilateralType);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new Shape(quadrilateral, quadrilateralType);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,21 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="triangle"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Triangle triangle, string quadrilateralType)
|
||||
{
|
||||
@ -58,17 +44,29 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.</value>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.</value>
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
@ -184,11 +182,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
string quadrilateralType = default;
|
||||
|
||||
@ -211,12 +209,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new ShapeOrNull(quadrilateral, quadrilateralType);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new ShapeOrNull(triangle, quadrilateralType);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new ShapeOrNull(quadrilateral, quadrilateralType);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SimpleQuadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
public SimpleQuadrilateral(QuadrilateralInterface quadrilateralInterface, ShapeInterface shapeInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="quadrilateralInterface"></param>
|
||||
public SimpleQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
|
||||
{
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
ShapeInterface = shapeInterface;
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralInterface
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -144,10 +144,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
@ -165,7 +167,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new SimpleQuadrilateral(quadrilateralInterface, shapeInterface);
|
||||
return new SimpleQuadrilateral(shapeInterface, quadrilateralInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="equilateralTriangle">equilateralTriangle</param>
|
||||
/// <param name="equilateralTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(EquilateralTriangle equilateralTriangle, string shapeType, string triangleType)
|
||||
@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="isoscelesTriangle">isoscelesTriangle</param>
|
||||
/// <param name="isoscelesTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(IsoscelesTriangle isoscelesTriangle, string shapeType, string triangleType)
|
||||
@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="scaleneTriangle">scaleneTriangle</param>
|
||||
/// <param name="scaleneTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(ScaleneTriangle scaleneTriangle, string shapeType, string triangleType)
|
||||
@ -87,17 +87,17 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// </summary>
|
||||
public EquilateralTriangle EquilateralTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// </summary>
|
||||
public IsoscelesTriangle IsoscelesTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// </summary>
|
||||
public ScaleneTriangle ScaleneTriangle { get; set; }
|
||||
|
||||
@ -228,13 +228,13 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader equilateralTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<EquilateralTriangle>(ref equilateralTriangleReader, options, out EquilateralTriangle equilateralTriangle);
|
||||
bool equilateralTriangleDeserialized = Client.ClientUtils.TryDeserialize<EquilateralTriangle>(ref equilateralTriangleReader, options, out EquilateralTriangle equilateralTriangle);
|
||||
|
||||
Utf8JsonReader isoscelesTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<IsoscelesTriangle>(ref isoscelesTriangleReader, options, out IsoscelesTriangle isoscelesTriangle);
|
||||
bool isoscelesTriangleDeserialized = Client.ClientUtils.TryDeserialize<IsoscelesTriangle>(ref isoscelesTriangleReader, options, out IsoscelesTriangle isoscelesTriangle);
|
||||
|
||||
Utf8JsonReader scaleneTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ScaleneTriangle>(ref scaleneTriangleReader, options, out ScaleneTriangle scaleneTriangle);
|
||||
bool scaleneTriangleDeserialized = Client.ClientUtils.TryDeserialize<ScaleneTriangle>(ref scaleneTriangleReader, options, out ScaleneTriangle scaleneTriangle);
|
||||
|
||||
string shapeType = default;
|
||||
string triangleType = default;
|
||||
@ -261,13 +261,13 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (equilateralTriangle != null)
|
||||
if (equilateralTriangleDeserialized)
|
||||
return new Triangle(equilateralTriangle, shapeType, triangleType);
|
||||
|
||||
if (isoscelesTriangle != null)
|
||||
if (isoscelesTriangleDeserialized)
|
||||
return new Triangle(isoscelesTriangle, shapeType, triangleType);
|
||||
|
||||
if (scaleneTriangle != null)
|
||||
if (scaleneTriangleDeserialized)
|
||||
return new Triangle(scaleneTriangle, shapeType, triangleType);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -69,6 +69,7 @@ docs/models/OuterEnumIntegerDefaultValue.md
|
||||
docs/models/ParentPet.md
|
||||
docs/models/Pet.md
|
||||
docs/models/Pig.md
|
||||
docs/models/PolymorphicProperty.md
|
||||
docs/models/Quadrilateral.md
|
||||
docs/models/QuadrilateralInterface.md
|
||||
docs/models/ReadOnlyFirst.md
|
||||
@ -174,6 +175,7 @@ src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
|
||||
src/Org.OpenAPITools/Model/ParentPet.cs
|
||||
src/Org.OpenAPITools/Model/Pet.cs
|
||||
src/Org.OpenAPITools/Model/Pig.cs
|
||||
src/Org.OpenAPITools/Model/PolymorphicProperty.cs
|
||||
src/Org.OpenAPITools/Model/Quadrilateral.cs
|
||||
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
|
||||
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Org.OpenAPITools.Model.PolymorphicProperty
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using Xunit;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Model;
|
||||
using Org.OpenAPITools.Client;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Org.OpenAPITools.Test.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for testing PolymorphicProperty
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
/// Please update the test case below to test the model.
|
||||
/// </remarks>
|
||||
public class PolymorphicPropertyTests : IDisposable
|
||||
{
|
||||
// TODO uncomment below to declare an instance variable for PolymorphicProperty
|
||||
//private PolymorphicProperty instance;
|
||||
|
||||
public PolymorphicPropertyTests()
|
||||
{
|
||||
// TODO uncomment below to create an instance of PolymorphicProperty
|
||||
//instance = new PolymorphicProperty();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Cleanup when everything is done.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of PolymorphicProperty
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void PolymorphicPropertyInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsType" PolymorphicProperty
|
||||
//Assert.IsType<PolymorphicProperty>(instance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -49,7 +49,9 @@ namespace Org.OpenAPITools.Client
|
||||
_jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
|
||||
_jsonOptions.Converters.Add(new MammalJsonConverter());
|
||||
_jsonOptions.Converters.Add(new NullableShapeJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ParentPetJsonConverter());
|
||||
_jsonOptions.Converters.Add(new PigJsonConverter());
|
||||
_jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter());
|
||||
_jsonOptions.Converters.Add(new QuadrilateralJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter());
|
||||
_jsonOptions.Converters.Add(new ShapeJsonConverter());
|
||||
|
@ -32,16 +32,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Cat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="catAllOf">catAllOf</param>
|
||||
/// <param name="dictionary"></param>
|
||||
/// <param name="catAllOf"></param>
|
||||
/// <param name="className">className (required)</param>
|
||||
/// <param name="color">color (default to "red")</param>
|
||||
public Cat(CatAllOf catAllOf, string className, string color = "red") : base(className, color)
|
||||
public Cat(Dictionary<string, int> dictionary, CatAllOf catAllOf, string className, string color = "red") : base(className, color)
|
||||
{
|
||||
Dictionary = dictionary;
|
||||
CatAllOf = catAllOf;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Cat
|
||||
/// Gets or Sets Dictionary
|
||||
/// </summary>
|
||||
public Dictionary<string, int> Dictionary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets CatAllOf
|
||||
/// </summary>
|
||||
public CatAllOf CatAllOf { get; set; }
|
||||
|
||||
@ -120,8 +127,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader dictionaryReader = reader;
|
||||
bool dictionaryDeserialized = Client.ClientUtils.TryDeserialize<Dictionary<string, int>>(ref dictionaryReader, options, out Dictionary<string, int> dictionary);
|
||||
|
||||
Utf8JsonReader catAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf catAllOf);
|
||||
bool catAllOfDeserialized = Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf catAllOf);
|
||||
|
||||
string className = default;
|
||||
string color = default;
|
||||
|
||||
@ -147,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new Cat(catAllOf, className, color);
|
||||
return new Cat(dictionary, catAllOf, className, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="childCatAllOf">childCatAllOf</param>
|
||||
/// <param name="childCatAllOf"></param>
|
||||
/// <param name="petType">petType (required)</param>
|
||||
public ChildCat(ChildCatAllOf childCatAllOf, string petType) : base(petType)
|
||||
{
|
||||
@ -40,7 +40,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ChildCat
|
||||
/// Gets or Sets ChildCatAllOf
|
||||
/// </summary>
|
||||
public ChildCatAllOf ChildCatAllOf { get; set; }
|
||||
|
||||
@ -120,7 +120,8 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader childCatAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf childCatAllOf);
|
||||
bool childCatAllOfDeserialized = Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf childCatAllOf);
|
||||
|
||||
string petType = default;
|
||||
|
||||
while (reader.Read())
|
||||
|
@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ComplexQuadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
public ComplexQuadrilateral(QuadrilateralInterface quadrilateralInterface, ShapeInterface shapeInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="quadrilateralInterface"></param>
|
||||
public ComplexQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
|
||||
{
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
ShapeInterface = shapeInterface;
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralInterface
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -144,10 +144,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
@ -165,7 +167,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new ComplexQuadrilateral(quadrilateralInterface, shapeInterface);
|
||||
return new ComplexQuadrilateral(shapeInterface, quadrilateralInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Dog" /> class.
|
||||
/// </summary>
|
||||
/// <param name="dogAllOf">dogAllOf</param>
|
||||
/// <param name="dogAllOf"></param>
|
||||
/// <param name="className">className (required)</param>
|
||||
/// <param name="color">color (default to "red")</param>
|
||||
public Dog(DogAllOf dogAllOf, string className, string color = "red") : base(className, color)
|
||||
@ -41,7 +41,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Dog
|
||||
/// Gets or Sets DogAllOf
|
||||
/// </summary>
|
||||
public DogAllOf DogAllOf { get; set; }
|
||||
|
||||
@ -121,7 +121,8 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader dogAllOfReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf dogAllOf);
|
||||
bool dogAllOfDeserialized = Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf dogAllOf);
|
||||
|
||||
string className = default;
|
||||
string color = default;
|
||||
|
||||
|
@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EquilateralTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public EquilateralTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
@ -41,12 +41,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
@ -145,9 +145,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="apple">apple</param>
|
||||
/// <param name="apple"></param>
|
||||
/// <param name="color">color</param>
|
||||
public Fruit(Apple apple, string color = default)
|
||||
{
|
||||
@ -43,7 +43,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="banana">banana</param>
|
||||
/// <param name="banana"></param>
|
||||
/// <param name="color">color</param>
|
||||
public Fruit(Banana banana, string color = default)
|
||||
{
|
||||
@ -52,12 +52,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruit
|
||||
/// Gets or Sets Apple
|
||||
/// </summary>
|
||||
public Apple Apple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruit
|
||||
/// Gets or Sets Banana
|
||||
/// </summary>
|
||||
public Banana Banana { get; set; }
|
||||
|
||||
@ -156,10 +156,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
bool appleDeserialized = Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
|
||||
Utf8JsonReader bananaReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
bool bananaDeserialized = Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
|
||||
string color = default;
|
||||
|
||||
@ -182,10 +182,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (apple != null)
|
||||
if (appleDeserialized)
|
||||
return new Fruit(apple, color);
|
||||
|
||||
if (banana != null)
|
||||
if (bananaDeserialized)
|
||||
return new Fruit(banana, color);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FruitReq" /> class.
|
||||
/// </summary>
|
||||
/// <param name="appleReq">appleReq</param>
|
||||
/// <param name="appleReq"></param>
|
||||
public FruitReq(AppleReq appleReq)
|
||||
{
|
||||
AppleReq = appleReq;
|
||||
@ -41,19 +41,19 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FruitReq" /> class.
|
||||
/// </summary>
|
||||
/// <param name="bananaReq">bananaReq</param>
|
||||
/// <param name="bananaReq"></param>
|
||||
public FruitReq(BananaReq bananaReq)
|
||||
{
|
||||
BananaReq = bananaReq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruitReq
|
||||
/// Gets or Sets AppleReq
|
||||
/// </summary>
|
||||
public AppleReq AppleReq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets fruitReq
|
||||
/// Gets or Sets BananaReq
|
||||
/// </summary>
|
||||
public BananaReq BananaReq { get; set; }
|
||||
|
||||
@ -141,10 +141,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReqReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<AppleReq>(ref appleReqReader, options, out AppleReq appleReq);
|
||||
bool appleReqDeserialized = Client.ClientUtils.TryDeserialize<AppleReq>(ref appleReqReader, options, out AppleReq appleReq);
|
||||
|
||||
Utf8JsonReader bananaReqReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<BananaReq>(ref bananaReqReader, options, out BananaReq bananaReq);
|
||||
bool bananaReqDeserialized = Client.ClientUtils.TryDeserialize<BananaReq>(ref bananaReqReader, options, out BananaReq bananaReq);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -163,10 +163,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (appleReq != null)
|
||||
if (appleReqDeserialized)
|
||||
return new FruitReq(appleReq);
|
||||
|
||||
if (bananaReq != null)
|
||||
if (bananaReqDeserialized)
|
||||
return new FruitReq(bananaReq);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -32,23 +32,23 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GmFruit" /> class.
|
||||
/// </summary>
|
||||
/// <param name="apple">apple</param>
|
||||
/// <param name="banana">banana</param>
|
||||
/// <param name="apple"></param>
|
||||
/// <param name="banana"></param>
|
||||
/// <param name="color">color</param>
|
||||
public GmFruit(Apple apple, Banana banana, string color = default)
|
||||
{
|
||||
Apple = apple;
|
||||
Banana = banana;
|
||||
Apple = Apple;
|
||||
Banana = Banana;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets gmFruit
|
||||
/// Gets or Sets Apple
|
||||
/// </summary>
|
||||
public Apple Apple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets gmFruit
|
||||
/// Gets or Sets Banana
|
||||
/// </summary>
|
||||
public Banana Banana { get; set; }
|
||||
|
||||
@ -147,10 +147,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader appleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
bool appleDeserialized = Client.ClientUtils.TryDeserialize<Apple>(ref appleReader, options, out Apple apple);
|
||||
|
||||
Utf8JsonReader bananaReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
bool bananaDeserialized = Client.ClientUtils.TryDeserialize<Banana>(ref bananaReader, options, out Banana banana);
|
||||
|
||||
string color = default;
|
||||
|
||||
|
@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IsoscelesTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public IsoscelesTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
@ -41,12 +41,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
@ -134,9 +134,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -32,16 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="pig">pig</param>
|
||||
public Mammal(Pig pig)
|
||||
{
|
||||
Pig = pig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="whale">whale</param>
|
||||
/// <param name="whale"></param>
|
||||
public Mammal(Whale whale)
|
||||
{
|
||||
Whale = whale;
|
||||
@ -50,27 +41,36 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
/// <param name="zebra">zebra</param>
|
||||
/// <param name="zebra"></param>
|
||||
public Mammal(Zebra zebra)
|
||||
{
|
||||
Zebra = zebra;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||
/// </summary>
|
||||
public Pig Pig { get; set; }
|
||||
/// <param name="pig"></param>
|
||||
public Mammal(Pig pig)
|
||||
{
|
||||
Pig = pig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Gets or Sets Whale
|
||||
/// </summary>
|
||||
public Whale Whale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets mammal
|
||||
/// Gets or Sets Zebra
|
||||
/// </summary>
|
||||
public Zebra Zebra { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// </summary>
|
||||
public Pig Pig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -175,14 +175,14 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader pigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Pig>(ref pigReader, options, out Pig pig);
|
||||
|
||||
Utf8JsonReader whaleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Whale>(ref whaleReader, options, out Whale whale);
|
||||
bool whaleDeserialized = Client.ClientUtils.TryDeserialize<Whale>(ref whaleReader, options, out Whale whale);
|
||||
|
||||
Utf8JsonReader zebraReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Zebra>(ref zebraReader, options, out Zebra zebra);
|
||||
bool zebraDeserialized = Client.ClientUtils.TryDeserialize<Zebra>(ref zebraReader, options, out Zebra zebra);
|
||||
|
||||
Utf8JsonReader pigReader = reader;
|
||||
bool pigDeserialized = Client.ClientUtils.TryDeserialize<Pig>(ref pigReader, options, out Pig pig);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -201,15 +201,15 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (pig != null)
|
||||
return new Mammal(pig);
|
||||
|
||||
if (whale != null)
|
||||
if (whaleDeserialized)
|
||||
return new Mammal(whale);
|
||||
|
||||
if (zebra != null)
|
||||
if (zebraDeserialized)
|
||||
return new Mammal(zebra);
|
||||
|
||||
if (pigDeserialized)
|
||||
return new Mammal(pig);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,33 +32,31 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
public NullableShape(Quadrilateral quadrilateral)
|
||||
{
|
||||
Quadrilateral = quadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="triangle"></param>
|
||||
public NullableShape(Triangle triangle)
|
||||
{
|
||||
Triangle = triangle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
|
||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.</value>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
public NullableShape(Quadrilateral quadrilateral)
|
||||
{
|
||||
Quadrilateral = quadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.</value>
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -163,11 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -186,12 +184,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new NullableShape(quadrilateral);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new NullableShape(triangle);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new NullableShape(quadrilateral);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -85,4 +85,64 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json converter for type ParentPet
|
||||
/// </summary>
|
||||
public class ParentPetJsonConverter : JsonConverter<ParentPet>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a boolean if the type is compatible with this converter.
|
||||
/// </summary>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvert(Type typeToConvert) => typeof(ParentPet).IsAssignableFrom(typeToConvert);
|
||||
|
||||
/// <summary>
|
||||
/// A Json reader.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="JsonException"></exception>
|
||||
public override ParentPet Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int currentDepth = reader.CurrentDepth;
|
||||
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
string petType = default;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
|
||||
break;
|
||||
|
||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||
{
|
||||
string propertyName = reader.GetString();
|
||||
reader.Read();
|
||||
|
||||
switch (propertyName)
|
||||
{
|
||||
case "pet_type":
|
||||
petType = reader.GetString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ParentPet(petType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json writer
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="parentPet"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions options) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||
/// </summary>
|
||||
/// <param name="basquePig">basquePig</param>
|
||||
/// <param name="basquePig"></param>
|
||||
public Pig(BasquePig basquePig)
|
||||
{
|
||||
BasquePig = basquePig;
|
||||
@ -41,19 +41,19 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||
/// </summary>
|
||||
/// <param name="danishPig">danishPig</param>
|
||||
/// <param name="danishPig"></param>
|
||||
public Pig(DanishPig danishPig)
|
||||
{
|
||||
DanishPig = danishPig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// Gets or Sets BasquePig
|
||||
/// </summary>
|
||||
public BasquePig BasquePig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Pig
|
||||
/// Gets or Sets DanishPig
|
||||
/// </summary>
|
||||
public DanishPig DanishPig { get; set; }
|
||||
|
||||
@ -162,10 +162,10 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader basquePigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<BasquePig>(ref basquePigReader, options, out BasquePig basquePig);
|
||||
bool basquePigDeserialized = Client.ClientUtils.TryDeserialize<BasquePig>(ref basquePigReader, options, out BasquePig basquePig);
|
||||
|
||||
Utf8JsonReader danishPigReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<DanishPig>(ref danishPigReader, options, out DanishPig danishPig);
|
||||
bool danishPigDeserialized = Client.ClientUtils.TryDeserialize<DanishPig>(ref danishPigReader, options, out DanishPig danishPig);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -184,10 +184,10 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (basquePig != null)
|
||||
if (basquePigDeserialized)
|
||||
return new Pig(basquePig);
|
||||
|
||||
if (danishPig != null)
|
||||
if (danishPigDeserialized)
|
||||
return new Pig(danishPig);
|
||||
|
||||
throw new JsonException();
|
||||
|
@ -0,0 +1,235 @@
|
||||
// <auto-generated>
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// PolymorphicProperty
|
||||
/// </summary>
|
||||
public partial class PolymorphicProperty : IEquatable<PolymorphicProperty>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_bool"></param>
|
||||
public PolymorphicProperty(bool _bool)
|
||||
{
|
||||
Bool = _bool;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_string"></param>
|
||||
public PolymorphicProperty(string _string)
|
||||
{
|
||||
String = _string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_object"></param>
|
||||
public PolymorphicProperty(Object _object)
|
||||
{
|
||||
Object = _object;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PolymorphicProperty" /> class.
|
||||
/// </summary>
|
||||
/// <param name="liststring"></param>
|
||||
public PolymorphicProperty(List<string> liststring)
|
||||
{
|
||||
Liststring = liststring;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Bool
|
||||
/// </summary>
|
||||
public bool Bool { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets String
|
||||
/// </summary>
|
||||
public string String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Object
|
||||
/// </summary>
|
||||
public Object Object { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Liststring
|
||||
/// </summary>
|
||||
public List<string> Liststring { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class PolymorphicProperty {\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input as PolymorphicProperty).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if PolymorphicProperty instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of PolymorphicProperty to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(PolymorphicProperty input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hashCode = 41;
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json converter for type PolymorphicProperty
|
||||
/// </summary>
|
||||
public class PolymorphicPropertyJsonConverter : JsonConverter<PolymorphicProperty>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a boolean if the type is compatible with this converter.
|
||||
/// </summary>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvert(Type typeToConvert) => typeof(PolymorphicProperty).IsAssignableFrom(typeToConvert);
|
||||
|
||||
/// <summary>
|
||||
/// A Json reader.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="typeToConvert"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="JsonException"></exception>
|
||||
public override PolymorphicProperty Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int currentDepth = reader.CurrentDepth;
|
||||
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader _boolReader = reader;
|
||||
bool _boolDeserialized = Client.ClientUtils.TryDeserialize<bool>(ref _boolReader, options, out bool _bool);
|
||||
|
||||
Utf8JsonReader _stringReader = reader;
|
||||
bool _stringDeserialized = Client.ClientUtils.TryDeserialize<string>(ref _stringReader, options, out string _string);
|
||||
|
||||
Utf8JsonReader _objectReader = reader;
|
||||
bool _objectDeserialized = Client.ClientUtils.TryDeserialize<Object>(ref _objectReader, options, out Object _object);
|
||||
|
||||
Utf8JsonReader liststringReader = reader;
|
||||
bool liststringDeserialized = Client.ClientUtils.TryDeserialize<List<string>>(ref liststringReader, options, out List<string> liststring);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
|
||||
break;
|
||||
|
||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||
{
|
||||
string propertyName = reader.GetString();
|
||||
reader.Read();
|
||||
|
||||
switch (propertyName)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_boolDeserialized)
|
||||
return new PolymorphicProperty(_bool);
|
||||
|
||||
if (_stringDeserialized)
|
||||
return new PolymorphicProperty(_string);
|
||||
|
||||
if (_objectDeserialized)
|
||||
return new PolymorphicProperty(_object);
|
||||
|
||||
if (liststringDeserialized)
|
||||
return new PolymorphicProperty(liststring);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Json writer
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="polymorphicProperty"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions options) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -32,31 +32,31 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="complexQuadrilateral">complexQuadrilateral</param>
|
||||
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral)
|
||||
{
|
||||
ComplexQuadrilateral = complexQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="simpleQuadrilateral">simpleQuadrilateral</param>
|
||||
/// <param name="simpleQuadrilateral"></param>
|
||||
public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral)
|
||||
{
|
||||
SimpleQuadrilateral = simpleQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||
/// </summary>
|
||||
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
||||
/// <param name="complexQuadrilateral"></param>
|
||||
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral)
|
||||
{
|
||||
ComplexQuadrilateral = complexQuadrilateral;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// </summary>
|
||||
public SimpleQuadrilateral SimpleQuadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ComplexQuadrilateral
|
||||
/// </summary>
|
||||
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -161,11 +161,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader complexQuadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ComplexQuadrilateral>(ref complexQuadrilateralReader, options, out ComplexQuadrilateral complexQuadrilateral);
|
||||
|
||||
Utf8JsonReader simpleQuadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<SimpleQuadrilateral>(ref simpleQuadrilateralReader, options, out SimpleQuadrilateral simpleQuadrilateral);
|
||||
bool simpleQuadrilateralDeserialized = Client.ClientUtils.TryDeserialize<SimpleQuadrilateral>(ref simpleQuadrilateralReader, options, out SimpleQuadrilateral simpleQuadrilateral);
|
||||
|
||||
Utf8JsonReader complexQuadrilateralReader = reader;
|
||||
bool complexQuadrilateralDeserialized = Client.ClientUtils.TryDeserialize<ComplexQuadrilateral>(ref complexQuadrilateralReader, options, out ComplexQuadrilateral complexQuadrilateral);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
@ -184,12 +184,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (complexQuadrilateral != null)
|
||||
return new Quadrilateral(complexQuadrilateral);
|
||||
|
||||
if (simpleQuadrilateral != null)
|
||||
if (simpleQuadrilateralDeserialized)
|
||||
return new Quadrilateral(simpleQuadrilateral);
|
||||
|
||||
if (complexQuadrilateralDeserialized)
|
||||
return new Quadrilateral(complexQuadrilateral);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScaleneTriangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
/// <param name="triangleInterface">triangleInterface</param>
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="triangleInterface"></param>
|
||||
public ScaleneTriangle(ShapeInterface shapeInterface, TriangleInterface triangleInterface)
|
||||
{
|
||||
ShapeInterface = shapeInterface;
|
||||
@ -41,12 +41,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// Gets or Sets TriangleInterface
|
||||
/// </summary>
|
||||
public TriangleInterface TriangleInterface { get; set; }
|
||||
|
||||
@ -145,9 +145,11 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader triangleInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
bool triangleInterfaceDeserialized = Client.ClientUtils.TryDeserialize<TriangleInterface>(ref triangleInterfaceReader, options, out TriangleInterface triangleInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -32,21 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="triangle"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Triangle triangle, string quadrilateralType)
|
||||
{
|
||||
@ -58,15 +44,29 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shape
|
||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public Shape(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shape
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
@ -182,11 +182,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
string quadrilateralType = default;
|
||||
|
||||
@ -209,12 +209,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new Shape(quadrilateral, quadrilateralType);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new Shape(triangle, quadrilateralType);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new Shape(quadrilateral, quadrilateralType);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,21 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateral">quadrilateral</param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <param name="triangle">triangle</param>
|
||||
/// <param name="triangle"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Triangle triangle, string quadrilateralType)
|
||||
{
|
||||
@ -58,17 +44,29 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
|
||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.</value>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
/// <param name="quadrilateral"></param>
|
||||
/// <param name="quadrilateralType">quadrilateralType (required)</param>
|
||||
public ShapeOrNull(Quadrilateral quadrilateral, string quadrilateralType)
|
||||
{
|
||||
if (quadrilateralType == null)
|
||||
throw new ArgumentNullException("quadrilateralType is a required property for ShapeOrNull and cannot be null.");
|
||||
|
||||
Quadrilateral = quadrilateral;
|
||||
QuadrilateralType = quadrilateralType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
|
||||
/// Gets or Sets Triangle
|
||||
/// </summary>
|
||||
/// <value>The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.</value>
|
||||
public Triangle Triangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quadrilateral
|
||||
/// </summary>
|
||||
public Quadrilateral Quadrilateral { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
@ -184,11 +182,11 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
Utf8JsonReader triangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
bool triangleDeserialized = Client.ClientUtils.TryDeserialize<Triangle>(ref triangleReader, options, out Triangle triangle);
|
||||
|
||||
Utf8JsonReader quadrilateralReader = reader;
|
||||
bool quadrilateralDeserialized = Client.ClientUtils.TryDeserialize<Quadrilateral>(ref quadrilateralReader, options, out Quadrilateral quadrilateral);
|
||||
|
||||
string quadrilateralType = default;
|
||||
|
||||
@ -211,12 +209,12 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (quadrilateral != null)
|
||||
return new ShapeOrNull(quadrilateral, quadrilateralType);
|
||||
|
||||
if (triangle != null)
|
||||
if (triangleDeserialized)
|
||||
return new ShapeOrNull(triangle, quadrilateralType);
|
||||
|
||||
if (quadrilateralDeserialized)
|
||||
return new ShapeOrNull(quadrilateral, quadrilateralType);
|
||||
|
||||
throw new JsonException();
|
||||
}
|
||||
|
||||
|
@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SimpleQuadrilateral" /> class.
|
||||
/// </summary>
|
||||
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
|
||||
/// <param name="shapeInterface">shapeInterface</param>
|
||||
public SimpleQuadrilateral(QuadrilateralInterface quadrilateralInterface, ShapeInterface shapeInterface)
|
||||
/// <param name="shapeInterface"></param>
|
||||
/// <param name="quadrilateralInterface"></param>
|
||||
public SimpleQuadrilateral(ShapeInterface shapeInterface, QuadrilateralInterface quadrilateralInterface)
|
||||
{
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
ShapeInterface = shapeInterface;
|
||||
QuadrilateralInterface = quadrilateralInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SimpleQuadrilateral
|
||||
/// Gets or Sets ShapeInterface
|
||||
/// </summary>
|
||||
public ShapeInterface ShapeInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralInterface
|
||||
/// </summary>
|
||||
public QuadrilateralInterface QuadrilateralInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@ -144,10 +144,12 @@ namespace Org.OpenAPITools.Model
|
||||
if (reader.TokenType != JsonTokenType.StartObject)
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
Utf8JsonReader shapeInterfaceReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
bool shapeInterfaceDeserialized = Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface shapeInterface);
|
||||
|
||||
Utf8JsonReader quadrilateralInterfaceReader = reader;
|
||||
bool quadrilateralInterfaceDeserialized = Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface quadrilateralInterface);
|
||||
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
@ -165,7 +167,7 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
return new SimpleQuadrilateral(quadrilateralInterface, shapeInterface);
|
||||
return new SimpleQuadrilateral(shapeInterface, quadrilateralInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="equilateralTriangle">equilateralTriangle</param>
|
||||
/// <param name="equilateralTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(EquilateralTriangle equilateralTriangle, string shapeType, string triangleType)
|
||||
@ -51,7 +51,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="isoscelesTriangle">isoscelesTriangle</param>
|
||||
/// <param name="isoscelesTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(IsoscelesTriangle isoscelesTriangle, string shapeType, string triangleType)
|
||||
@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||
/// </summary>
|
||||
/// <param name="scaleneTriangle">scaleneTriangle</param>
|
||||
/// <param name="scaleneTriangle"></param>
|
||||
/// <param name="shapeType">shapeType (required)</param>
|
||||
/// <param name="triangleType">triangleType (required)</param>
|
||||
public Triangle(ScaleneTriangle scaleneTriangle, string shapeType, string triangleType)
|
||||
@ -87,17 +87,17 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets EquilateralTriangle
|
||||
/// </summary>
|
||||
public EquilateralTriangle EquilateralTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets IsoscelesTriangle
|
||||
/// </summary>
|
||||
public IsoscelesTriangle IsoscelesTriangle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Triangle
|
||||
/// Gets or Sets ScaleneTriangle
|
||||
/// </summary>
|
||||
public ScaleneTriangle ScaleneTriangle { get; set; }
|
||||
|
||||
@ -228,13 +228,13 @@ namespace Org.OpenAPITools.Model
|
||||
throw new JsonException();
|
||||
|
||||
Utf8JsonReader equilateralTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<EquilateralTriangle>(ref equilateralTriangleReader, options, out EquilateralTriangle equilateralTriangle);
|
||||
bool equilateralTriangleDeserialized = Client.ClientUtils.TryDeserialize<EquilateralTriangle>(ref equilateralTriangleReader, options, out EquilateralTriangle equilateralTriangle);
|
||||
|
||||
Utf8JsonReader isoscelesTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<IsoscelesTriangle>(ref isoscelesTriangleReader, options, out IsoscelesTriangle isoscelesTriangle);
|
||||
bool isoscelesTriangleDeserialized = Client.ClientUtils.TryDeserialize<IsoscelesTriangle>(ref isoscelesTriangleReader, options, out IsoscelesTriangle isoscelesTriangle);
|
||||
|
||||
Utf8JsonReader scaleneTriangleReader = reader;
|
||||
Client.ClientUtils.TryDeserialize<ScaleneTriangle>(ref scaleneTriangleReader, options, out ScaleneTriangle scaleneTriangle);
|
||||
bool scaleneTriangleDeserialized = Client.ClientUtils.TryDeserialize<ScaleneTriangle>(ref scaleneTriangleReader, options, out ScaleneTriangle scaleneTriangle);
|
||||
|
||||
string shapeType = default;
|
||||
string triangleType = default;
|
||||
@ -261,13 +261,13 @@ namespace Org.OpenAPITools.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (equilateralTriangle != null)
|
||||
if (equilateralTriangleDeserialized)
|
||||
return new Triangle(equilateralTriangle, shapeType, triangleType);
|
||||
|
||||
if (isoscelesTriangle != null)
|
||||
if (isoscelesTriangleDeserialized)
|
||||
return new Triangle(isoscelesTriangle, shapeType, triangleType);
|
||||
|
||||
if (scaleneTriangle != null)
|
||||
if (scaleneTriangleDeserialized)
|
||||
return new Triangle(scaleneTriangle, shapeType, triangleType);
|
||||
|
||||
throw new JsonException();
|
||||
|
Loading…
x
Reference in New Issue
Block a user