forked from loafle/openapi-generator-original
[csharp] Fixed discriminator (#20624)
* fixed discriminator * build samples * minor refactors * build samples * replaced boolean with protected method --------- Co-authored-by: devhl <shawnkanyer@gmail.com>
This commit is contained in:
parent
97c805f0e0
commit
61262e939a
@ -555,7 +555,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
? false
|
? false
|
||||||
: model.parentModel.allVars.stream().anyMatch(p ->
|
: model.parentModel.allVars.stream().anyMatch(p ->
|
||||||
p.name.equals(property.name) &&
|
p.name.equals(property.name) &&
|
||||||
(p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false || p.isDiscriminator));
|
(p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -726,6 +726,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
|||||||
property.vendorExtensions.put("x-is-value-type", isValueType);
|
property.vendorExtensions.put("x-is-value-type", isValueType);
|
||||||
property.vendorExtensions.put("x-is-reference-type", !isValueType);
|
property.vendorExtensions.put("x-is-reference-type", !isValueType);
|
||||||
property.vendorExtensions.put("x-is-nullable-type", this.getNullableReferencesTypes() || isValueType);
|
property.vendorExtensions.put("x-is-nullable-type", this.getNullableReferencesTypes() || isValueType);
|
||||||
|
property.vendorExtensions.put("x-is-base-or-new-discriminator", (property.isDiscriminator && !property.isInherited) || (property.isDiscriminator && property.isNew));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void patchPropertyIsInherited(CodegenModel model, CodegenProperty property) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
|
protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
|
||||||
@ -741,6 +745,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
|||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.patchPropertyIsInherited(model, property);
|
||||||
|
|
||||||
patchPropertyVendorExtensions(property);
|
patchPropertyVendorExtensions(property);
|
||||||
|
|
||||||
property.name = patchPropertyName(model, property.name);
|
property.name = patchPropertyName(model, property.name);
|
||||||
|
@ -1608,6 +1608,18 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void patchPropertyIsInherited(CodegenModel model, CodegenProperty property) {
|
||||||
|
if (GENERICHOST.equals(getLibrary())) {
|
||||||
|
// the isInherited property is not always correct
|
||||||
|
// fixing it here causes a breaking change in some generators
|
||||||
|
// only do this in generators that are prepared for the improvement
|
||||||
|
if (model.parentModel != null && model.parentModel.allVars.stream().anyMatch(v -> v.baseName.equals(property.baseName))) {
|
||||||
|
property.isInherited = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
|
protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
|
||||||
super.patchProperty(enumRefs, model, property);
|
super.patchProperty(enumRefs, model, property);
|
||||||
@ -1616,10 +1628,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
if (!property.isContainer && (this.getNullableTypes().contains(property.dataType) || property.isEnum)) {
|
if (!property.isContainer && (this.getNullableTypes().contains(property.dataType) || property.isEnum)) {
|
||||||
property.vendorExtensions.put("x-csharp-value-type", true);
|
property.vendorExtensions.put("x-csharp-value-type", true);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (model.parentModel != null && model.parentModel.allVars.stream().anyMatch(v -> v.baseName.equals(property.baseName))) {
|
|
||||||
property.isInherited = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@
|
|||||||
{{#isDiscriminator}}
|
{{#isDiscriminator}}
|
||||||
{{^model.composedSchemas.anyOf}}
|
{{^model.composedSchemas.anyOf}}
|
||||||
{{^model.composedSchemas.oneOf}}
|
{{^model.composedSchemas.oneOf}}
|
||||||
writer.WriteString("{{baseName}}", {{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{/isEnum}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{datatypeWithEnum}}}ToJsonValue{{/isInnerEnum}}{{^isInnerEnum}}{{{datatypeWithEnum}}}ValueConverter.ToJsonValue{{/isInnerEnum}}({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}.Value{{/required}}){{/isEnum}}{{/isNew}});
|
writer.WriteString("{{baseName}}", {{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{/isEnum}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{datatypeWithEnum}}}ToJsonValue{{/isInnerEnum}}{{^isInnerEnum}}{{{datatypeWithEnum}}}ValueConverter.ToJsonValue{{/isInnerEnum}}({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}.Value{{/required}}){{/isEnum}});
|
||||||
|
|
||||||
{{/model.composedSchemas.oneOf}}
|
{{/model.composedSchemas.oneOf}}
|
||||||
{{/model.composedSchemas.anyOf}}
|
{{/model.composedSchemas.anyOf}}
|
||||||
|
@ -34,6 +34,13 @@
|
|||||||
{{/isNew}}
|
{{/isNew}}
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
{{/isDiscriminator}}
|
{{/isDiscriminator}}
|
||||||
|
{{#vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
|
{{^model.composedSchemas.anyOf}}
|
||||||
|
{{^model.composedSchemas.oneOf}}
|
||||||
|
{{name}} = {{^isEnum}}this.GetType().Name{{/isEnum}}{{#isEnum}}({{datatypeWithEnum}})Enum.Parse(typeof({{datatypeWithEnum}}), this.GetType().Name){{/isEnum}};
|
||||||
|
{{/model.composedSchemas.oneOf}}
|
||||||
|
{{/model.composedSchemas.anyOf}}
|
||||||
|
{{/vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -71,6 +78,13 @@
|
|||||||
{{/isNew}}
|
{{/isNew}}
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
{{/isDiscriminator}}
|
{{/isDiscriminator}}
|
||||||
|
{{#vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
|
{{^model.composedSchemas.anyOf}}
|
||||||
|
{{^model.composedSchemas.oneOf}}
|
||||||
|
{{name}} = {{^isEnum}}this.GetType().Name{{/isEnum}}{{#isEnum}}({{datatypeWithEnum}})Enum.Parse(typeof({{datatypeWithEnum}}), this.GetType().Name){{/isEnum}};
|
||||||
|
{{/model.composedSchemas.oneOf}}
|
||||||
|
{{/model.composedSchemas.anyOf}}
|
||||||
|
{{/vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -162,7 +176,7 @@
|
|||||||
{{/vendorExtensions.x-duplicated-data-type}}
|
{{/vendorExtensions.x-duplicated-data-type}}
|
||||||
{{/composedSchemas.oneOf}}
|
{{/composedSchemas.oneOf}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
{{#isDiscriminator}}
|
{{#vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
{{^model.composedSchemas.anyOf}}
|
{{^model.composedSchemas.anyOf}}
|
||||||
{{^model.composedSchemas.oneOf}}
|
{{^model.composedSchemas.oneOf}}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -170,12 +184,12 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public {{#isNew}}new {{/isNew}}{{datatypeWithEnum}} {{name}} { get; } = {{^isNew}}"{{classname}}"{{/isNew}}{{#isNew}}{{^isEnum}}"{{classname}}"{{/isEnum}}{{#isEnum}}({{datatypeWithEnum}})Enum.Parse(typeof({{datatypeWithEnum}}), "{{classname}}"){{/isEnum}}{{/isNew}};
|
public {{#isNew}}new {{/isNew}}{{datatypeWithEnum}} {{name}} { get; }
|
||||||
|
|
||||||
{{/model.composedSchemas.oneOf}}
|
{{/model.composedSchemas.oneOf}}
|
||||||
{{/model.composedSchemas.anyOf}}
|
{{/model.composedSchemas.anyOf}}
|
||||||
{{/isDiscriminator}}
|
{{/vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
{{^isDiscriminator}}
|
{{^vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
{{^isEnum}}
|
{{^isEnum}}
|
||||||
{{#isInherited}}
|
{{#isInherited}}
|
||||||
{{#isNew}}
|
{{#isNew}}
|
||||||
@ -228,7 +242,7 @@
|
|||||||
|
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
{{/isDiscriminator}}
|
{{/vendorExtensions.x-is-base-or-new-discriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
{{#isAdditionalPropertiesTrue}}
|
{{#isAdditionalPropertiesTrue}}
|
||||||
{{^parentModel}}
|
{{^parentModel}}
|
||||||
|
@ -2836,6 +2836,40 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
Descendant1:
|
||||||
|
allOf:
|
||||||
|
- $ref: "#/components/schemas/TestDescendants"
|
||||||
|
- required:
|
||||||
|
- "descendantName"
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
descendantName:
|
||||||
|
type: "string"
|
||||||
|
Descendant2:
|
||||||
|
allOf:
|
||||||
|
- $ref: "#/components/schemas/TestDescendants"
|
||||||
|
- required:
|
||||||
|
- "confidentiality"
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
confidentiality:
|
||||||
|
type: "string"
|
||||||
|
TestDescendants:
|
||||||
|
required:
|
||||||
|
- "alternativeName"
|
||||||
|
- "objectType"
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
alternativeName:
|
||||||
|
type: "string"
|
||||||
|
objectType:
|
||||||
|
type: "string"
|
||||||
|
enum:
|
||||||
|
- "Descendant1"
|
||||||
|
- "Descendant2"
|
||||||
|
description: ""
|
||||||
|
discriminator:
|
||||||
|
propertyName: "objectType"
|
||||||
CopyActivity:
|
CopyActivity:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
@ -57,13 +57,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonPropertyName("children")]
|
[JsonPropertyName("children")]
|
||||||
public List<Child> Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new Option<List<Child>>(value); } }
|
public List<Child> Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new Option<List<Child>>(value); } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string Type { get; } = "Adult";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -59,13 +59,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonPropertyName("age")]
|
[JsonPropertyName("age")]
|
||||||
public int? Age { get { return this.AgeOption; } set { this.AgeOption = new Option<int?>(value); } }
|
public int? Age { get { return this.AgeOption; } set { this.AgeOption = new Option<int?>(value); } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string Type { get; } = "Child";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of BoosterSeat
|
/// Used to track the state of BoosterSeat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -39,6 +39,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
FirstNameOption = firstName;
|
FirstNameOption = firstName;
|
||||||
LastNameOption = lastName;
|
LastNameOption = lastName;
|
||||||
|
Type = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string Type { get; } = "Person";
|
public string Type { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -34,6 +34,8 @@ docs/models/CopyActivity.md
|
|||||||
docs/models/DanishPig.md
|
docs/models/DanishPig.md
|
||||||
docs/models/DateOnlyClass.md
|
docs/models/DateOnlyClass.md
|
||||||
docs/models/DeprecatedObject.md
|
docs/models/DeprecatedObject.md
|
||||||
|
docs/models/Descendant1.md
|
||||||
|
docs/models/Descendant2.md
|
||||||
docs/models/Dog.md
|
docs/models/Dog.md
|
||||||
docs/models/Drawing.md
|
docs/models/Drawing.md
|
||||||
docs/models/EntityBase.md
|
docs/models/EntityBase.md
|
||||||
@ -116,6 +118,8 @@ docs/models/SpecialModelName.md
|
|||||||
docs/models/Tag.md
|
docs/models/Tag.md
|
||||||
docs/models/TestCollectionEndingWithWordList.md
|
docs/models/TestCollectionEndingWithWordList.md
|
||||||
docs/models/TestCollectionEndingWithWordListObject.md
|
docs/models/TestCollectionEndingWithWordListObject.md
|
||||||
|
docs/models/TestDescendants.md
|
||||||
|
docs/models/TestDescendantsObjectType.md
|
||||||
docs/models/TestEnumParametersEnumHeaderStringParameter.md
|
docs/models/TestEnumParametersEnumHeaderStringParameter.md
|
||||||
docs/models/TestEnumParametersEnumQueryDoubleParameter.md
|
docs/models/TestEnumParametersEnumQueryDoubleParameter.md
|
||||||
docs/models/TestEnumParametersEnumQueryIntegerParameter.md
|
docs/models/TestEnumParametersEnumQueryIntegerParameter.md
|
||||||
@ -195,6 +199,8 @@ src/Org.OpenAPITools/Model/CopyActivity.cs
|
|||||||
src/Org.OpenAPITools/Model/DanishPig.cs
|
src/Org.OpenAPITools/Model/DanishPig.cs
|
||||||
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
||||||
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant1.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant2.cs
|
||||||
src/Org.OpenAPITools/Model/Dog.cs
|
src/Org.OpenAPITools/Model/Dog.cs
|
||||||
src/Org.OpenAPITools/Model/Drawing.cs
|
src/Org.OpenAPITools/Model/Drawing.cs
|
||||||
src/Org.OpenAPITools/Model/EntityBase.cs
|
src/Org.OpenAPITools/Model/EntityBase.cs
|
||||||
@ -277,6 +283,8 @@ src/Org.OpenAPITools/Model/SpecialModelName.cs
|
|||||||
src/Org.OpenAPITools/Model/Tag.cs
|
src/Org.OpenAPITools/Model/Tag.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/TestDescendants.cs
|
||||||
|
src/Org.OpenAPITools/Model/TestDescendantsObjectType.cs
|
||||||
src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs
|
src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs
|
||||||
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs
|
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs
|
||||||
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
|
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
|
||||||
|
@ -2592,6 +2592,37 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
Descendant1:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
descendantName:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- descendantName
|
||||||
|
type: object
|
||||||
|
Descendant2:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
confidentiality:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- confidentiality
|
||||||
|
type: object
|
||||||
|
TestDescendants:
|
||||||
|
description: ""
|
||||||
|
discriminator:
|
||||||
|
propertyName: objectType
|
||||||
|
properties:
|
||||||
|
alternativeName:
|
||||||
|
type: string
|
||||||
|
objectType:
|
||||||
|
$ref: '#/components/schemas/TestDescendants_objectType'
|
||||||
|
required:
|
||||||
|
- alternativeName
|
||||||
|
- objectType
|
||||||
|
type: object
|
||||||
CopyActivity:
|
CopyActivity:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/EntityBase'
|
- $ref: '#/components/schemas/EntityBase'
|
||||||
@ -2984,6 +3015,11 @@ components:
|
|||||||
type: number
|
type: number
|
||||||
- $ref: '#/components/schemas/MixedSubId'
|
- $ref: '#/components/schemas/MixedSubId'
|
||||||
description: Mixed anyOf types for testing
|
description: Mixed anyOf types for testing
|
||||||
|
TestDescendants_objectType:
|
||||||
|
enum:
|
||||||
|
- Descendant1
|
||||||
|
- Descendant2
|
||||||
|
type: string
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
petstore_auth:
|
petstore_auth:
|
||||||
flows:
|
flows:
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant1
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **TestDescendantsObjectType** | |
|
||||||
|
**DescendantName** | **string** | |
|
||||||
|
|
||||||
|
[[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,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant2
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **TestDescendantsObjectType** | |
|
||||||
|
**Confidentiality** | **string** | |
|
||||||
|
|
||||||
|
[[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,11 @@
|
|||||||
|
# Org.OpenAPITools.Model.TestDescendants
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **TestDescendantsObjectType** | |
|
||||||
|
|
||||||
|
[[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,9 @@
|
|||||||
|
# Org.OpenAPITools.Model.TestDescendantsObjectType
|
||||||
|
|
||||||
|
## 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,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant1
|
||||||
|
/// </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 Descendant1Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant1
|
||||||
|
//private Descendant1 instance;
|
||||||
|
|
||||||
|
public Descendant1Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant1
|
||||||
|
//instance = new Descendant1();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant1
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant1
|
||||||
|
//Assert.IsType<Descendant1>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'DescendantName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void DescendantNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'DescendantName'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant2
|
||||||
|
/// </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 Descendant2Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant2
|
||||||
|
//private Descendant2 instance;
|
||||||
|
|
||||||
|
public Descendant2Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant2
|
||||||
|
//instance = new Descendant2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant2
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant2
|
||||||
|
//Assert.IsType<Descendant2>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'Confidentiality'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ConfidentialityTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'Confidentiality'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing TestDescendantsObjectType
|
||||||
|
/// </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 TestDescendantsObjectTypeTests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for TestDescendantsObjectType
|
||||||
|
//private TestDescendantsObjectType instance;
|
||||||
|
|
||||||
|
public TestDescendantsObjectTypeTests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of TestDescendantsObjectType
|
||||||
|
//instance = new TestDescendantsObjectType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of TestDescendantsObjectType
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestDescendantsObjectTypeInstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" TestDescendantsObjectType
|
||||||
|
//Assert.IsType<TestDescendantsObjectType>(instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing TestDescendants
|
||||||
|
/// </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 TestDescendantsTests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for TestDescendants
|
||||||
|
//private TestDescendants instance;
|
||||||
|
|
||||||
|
public TestDescendantsTests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of TestDescendants
|
||||||
|
//instance = new TestDescendants();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestDescendantsInstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant1 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant1 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant1().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant2 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant2 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant2().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'AlternativeName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void AlternativeNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'AlternativeName'
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'ObjectType'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ObjectTypeTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'ObjectType'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -213,6 +213,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
return RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClassRequiredNullableEnumIntegerOnly).ToString();
|
return RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClassRequiredNullableEnumIntegerOnly).ToString();
|
||||||
if (obj is RequiredClassRequiredNullableEnumString requiredClassRequiredNullableEnumString)
|
if (obj is RequiredClassRequiredNullableEnumString requiredClassRequiredNullableEnumString)
|
||||||
return RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClassRequiredNullableEnumString);
|
return RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClassRequiredNullableEnumString);
|
||||||
|
if (obj is TestDescendantsObjectType testDescendantsObjectType)
|
||||||
|
return TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendantsObjectType);
|
||||||
if (obj is TestEnumParametersEnumHeaderStringParameter testEnumParametersEnumHeaderStringParameter)
|
if (obj is TestEnumParametersEnumHeaderStringParameter testEnumParametersEnumHeaderStringParameter)
|
||||||
return TestEnumParametersEnumHeaderStringParameterValueConverter.ToJsonValue(testEnumParametersEnumHeaderStringParameter);
|
return TestEnumParametersEnumHeaderStringParameterValueConverter.ToJsonValue(testEnumParametersEnumHeaderStringParameter);
|
||||||
if (obj is TestEnumParametersEnumQueryDoubleParameter testEnumParametersEnumQueryDoubleParameter)
|
if (obj is TestEnumParametersEnumQueryDoubleParameter testEnumParametersEnumQueryDoubleParameter)
|
||||||
|
@ -64,6 +64,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant1JsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant2JsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DogJsonConverter());
|
_jsonOptions.Converters.Add(new DogJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
||||||
@ -167,6 +169,9 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new TagJsonConverter());
|
_jsonOptions.Converters.Add(new TagJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsObjectTypeJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsObjectTypeNullableJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterJsonConverter());
|
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterNullableJsonConverter());
|
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterNullableJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestEnumParametersEnumQueryDoubleParameterJsonConverter());
|
_jsonOptions.Converters.Add(new TestEnumParametersEnumQueryDoubleParameterJsonConverter());
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Animal(Option<string> color = default)
|
public Animal(Option<string> color = default)
|
||||||
{
|
{
|
||||||
|
ClassName = this.GetType().Name;
|
||||||
ColorOption = color;
|
ColorOption = color;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string ClassName { get; } = "Animal";
|
public string ClassName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Color
|
/// Used to track the state of Color
|
||||||
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Cat";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Declawed
|
/// Used to track the state of Declawed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public ChildCat(Option<string> name = default) : base()
|
public ChildCat(Option<string> name = default) : base()
|
||||||
{
|
{
|
||||||
|
PetType = (ChildCatAllOfPetType)Enum.Parse(typeof(ChildCatAllOfPetType), this.GetType().Name);
|
||||||
NameOption = name;
|
NameOption = name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new ChildCatAllOfPetType PetType { get; } = (ChildCatAllOfPetType)Enum.Parse(typeof(ChildCatAllOfPetType), "ChildCat");
|
public new ChildCatAllOfPetType PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Name
|
/// Used to track the state of Name
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public CopyActivity(string copyActivitytt) : base()
|
public CopyActivity(string copyActivitytt) : base()
|
||||||
{
|
{
|
||||||
|
Schema = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), this.GetType().Name);
|
||||||
CopyActivitytt = copyActivitytt;
|
CopyActivitytt = copyActivitytt;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
|
public new SchemaEnum Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets CopyActivitytt
|
/// Gets or Sets CopyActivitytt
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant1
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant1 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant1" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="descendantName">descendantName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant1(string alternativeName, string descendantName) : base(alternativeName)
|
||||||
|
{
|
||||||
|
DescendantName = descendantName;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets DescendantName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("descendantName")]
|
||||||
|
public string DescendantName { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant1 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" DescendantName: ").Append(DescendantName).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant1JsonConverter : JsonConverter<Descendant1>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant1 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> descendantName = default;
|
||||||
|
Option<TestDescendantsObjectType?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "descendantName":
|
||||||
|
descendantName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendantsObjectType?>(TestDescendantsObjectTypeValueConverter.FromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!descendantName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(descendantName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendantName.IsSet && descendantName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendantName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
return new Descendant1(alternativeName.Value, descendantName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant1, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant1.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendant1.DescendantName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant1.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("descendantName", descendant1.DescendantName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(descendant1.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant2
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant2 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant2" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="confidentiality">confidentiality</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant2(string alternativeName, string confidentiality) : base(alternativeName)
|
||||||
|
{
|
||||||
|
Confidentiality = confidentiality;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets Confidentiality
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("confidentiality")]
|
||||||
|
public string Confidentiality { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant2 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" Confidentiality: ").Append(Confidentiality).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant2JsonConverter : JsonConverter<Descendant2>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant2 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> confidentiality = default;
|
||||||
|
Option<TestDescendantsObjectType?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "confidentiality":
|
||||||
|
confidentiality = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendantsObjectType?>(TestDescendantsObjectTypeValueConverter.FromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!confidentiality.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(confidentiality));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (confidentiality.IsSet && confidentiality.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(confidentiality), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
return new Descendant2(alternativeName.Value, confidentiality.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant2, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant2.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
if (descendant2.Confidentiality == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant2.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("confidentiality", descendant2.Confidentiality);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(descendant2.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Dog";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Breed
|
/// Used to track the state of Breed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public EntityBase()
|
public EntityBase()
|
||||||
{
|
{
|
||||||
|
Schema = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string Schema { get; } = "EntityBase";
|
public string Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public GrandparentAnimal()
|
public GrandparentAnimal()
|
||||||
{
|
{
|
||||||
|
PetType = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string PetType { get; } = "GrandparentAnimal";
|
public string PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -40,13 +40,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string PetType { get; } = "ParentPet";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -0,0 +1,219 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
public partial class TestDescendants : IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TestDescendants" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public TestDescendants(string alternativeName)
|
||||||
|
{
|
||||||
|
AlternativeName = alternativeName;
|
||||||
|
ObjectType = (TestDescendantsObjectType)Enum.Parse(typeof(TestDescendantsObjectType), this.GetType().Name);
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets AlternativeName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("alternativeName")]
|
||||||
|
public string AlternativeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public TestDescendantsObjectType ObjectType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets additional properties
|
||||||
|
/// </summary>
|
||||||
|
[JsonExtensionData]
|
||||||
|
public Dictionary<string, JsonElement> AdditionalProperties { get; } = 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 TestDescendants {\n");
|
||||||
|
sb.Append(" AlternativeName: ").Append(AlternativeName).Append("\n");
|
||||||
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
public class TestDescendantsJsonConverter : JsonConverter<TestDescendants>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override TestDescendants Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<TestDescendantsObjectType?> objectType = default;
|
||||||
|
|
||||||
|
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "objectType");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Descendant1"))
|
||||||
|
return JsonSerializer.Deserialize<Descendant1>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Descendant2"))
|
||||||
|
return JsonSerializer.Deserialize<Descendant2>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendantsObjectType?>(TestDescendantsObjectTypeValueConverter.FromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class TestDescendants.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class TestDescendants.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class TestDescendants.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class TestDescendants.");
|
||||||
|
|
||||||
|
return new TestDescendants(alternativeName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendants"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (testDescendants is Descendant1 descendant1){
|
||||||
|
JsonSerializer.Serialize<Descendant1>(writer, descendant1, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testDescendants is Descendant2 descendant2){
|
||||||
|
JsonSerializer.Serialize<Descendant2>(writer, descendant2, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, testDescendants, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendants"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (testDescendants.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", testDescendants.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,174 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines TestDescendants_objectType
|
||||||
|
/// </summary>
|
||||||
|
public enum TestDescendantsObjectType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Descendant1 for value: Descendant1
|
||||||
|
/// </summary>
|
||||||
|
Descendant1 = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Descendant2 for value: Descendant2
|
||||||
|
/// </summary>
|
||||||
|
Descendant2 = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts <see cref="TestDescendantsObjectType"/> to and from the JSON value
|
||||||
|
/// </summary>
|
||||||
|
public static class TestDescendantsObjectTypeValueConverter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a given value to <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TestDescendantsObjectType FromString(string value)
|
||||||
|
{
|
||||||
|
if (value.Equals("Descendant1"))
|
||||||
|
return TestDescendantsObjectType.Descendant1;
|
||||||
|
|
||||||
|
if (value.Equals("Descendant2"))
|
||||||
|
return TestDescendantsObjectType.Descendant2;
|
||||||
|
|
||||||
|
throw new NotImplementedException($"Could not convert value to type TestDescendantsObjectType: '{value}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a given value to <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TestDescendantsObjectType? FromStringOrDefault(string value)
|
||||||
|
{
|
||||||
|
if (value.Equals("Descendant1"))
|
||||||
|
return TestDescendantsObjectType.Descendant1;
|
||||||
|
|
||||||
|
if (value.Equals("Descendant2"))
|
||||||
|
return TestDescendantsObjectType.Descendant2;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the <see cref="TestDescendantsObjectType"/> to the json value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public static string ToJsonValue(TestDescendantsObjectType value)
|
||||||
|
{
|
||||||
|
if (value == TestDescendantsObjectType.Descendant1)
|
||||||
|
return "Descendant1";
|
||||||
|
|
||||||
|
if (value == TestDescendantsObjectType.Descendant2)
|
||||||
|
return "Descendant2";
|
||||||
|
|
||||||
|
throw new NotImplementedException($"Value could not be handled: '{value}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public class TestDescendantsObjectTypeJsonConverter : JsonConverter<TestDescendantsObjectType>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a from the Json object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override TestDescendantsObjectType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
string rawValue = reader.GetString();
|
||||||
|
|
||||||
|
TestDescendantsObjectType? result = rawValue == null
|
||||||
|
? null
|
||||||
|
: TestDescendantsObjectTypeValueConverter.FromStringOrDefault(rawValue);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
return result.Value;
|
||||||
|
|
||||||
|
throw new JsonException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the TestDescendantsObjectType to the json writer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendantsObjectType"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendantsObjectType testDescendantsObjectType, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(testDescendantsObjectType.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
public class TestDescendantsObjectTypeNullableJsonConverter : JsonConverter<TestDescendantsObjectType?>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a TestDescendantsObjectType from the Json object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override TestDescendantsObjectType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
string rawValue = reader.GetString();
|
||||||
|
|
||||||
|
TestDescendantsObjectType? result = rawValue == null
|
||||||
|
? null
|
||||||
|
: TestDescendantsObjectTypeValueConverter.FromStringOrDefault(rawValue);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
return result.Value;
|
||||||
|
|
||||||
|
throw new JsonException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the DateTime to the json writer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendantsObjectType"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendantsObjectType? testDescendantsObjectType, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(testDescendantsObjectType?.ToString() ?? "null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,8 @@ docs/models/CopyActivity.md
|
|||||||
docs/models/DanishPig.md
|
docs/models/DanishPig.md
|
||||||
docs/models/DateOnlyClass.md
|
docs/models/DateOnlyClass.md
|
||||||
docs/models/DeprecatedObject.md
|
docs/models/DeprecatedObject.md
|
||||||
|
docs/models/Descendant1.md
|
||||||
|
docs/models/Descendant2.md
|
||||||
docs/models/Dog.md
|
docs/models/Dog.md
|
||||||
docs/models/Drawing.md
|
docs/models/Drawing.md
|
||||||
docs/models/EntityBase.md
|
docs/models/EntityBase.md
|
||||||
@ -100,6 +102,7 @@ docs/models/SpecialModelName.md
|
|||||||
docs/models/Tag.md
|
docs/models/Tag.md
|
||||||
docs/models/TestCollectionEndingWithWordList.md
|
docs/models/TestCollectionEndingWithWordList.md
|
||||||
docs/models/TestCollectionEndingWithWordListObject.md
|
docs/models/TestCollectionEndingWithWordListObject.md
|
||||||
|
docs/models/TestDescendants.md
|
||||||
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
docs/models/TestResult.md
|
docs/models/TestResult.md
|
||||||
docs/models/TestResultCode.md
|
docs/models/TestResultCode.md
|
||||||
@ -171,6 +174,8 @@ src/Org.OpenAPITools/Model/CopyActivity.cs
|
|||||||
src/Org.OpenAPITools/Model/DanishPig.cs
|
src/Org.OpenAPITools/Model/DanishPig.cs
|
||||||
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
||||||
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant1.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant2.cs
|
||||||
src/Org.OpenAPITools/Model/Dog.cs
|
src/Org.OpenAPITools/Model/Dog.cs
|
||||||
src/Org.OpenAPITools/Model/Drawing.cs
|
src/Org.OpenAPITools/Model/Drawing.cs
|
||||||
src/Org.OpenAPITools/Model/EntityBase.cs
|
src/Org.OpenAPITools/Model/EntityBase.cs
|
||||||
@ -238,6 +243,7 @@ src/Org.OpenAPITools/Model/SpecialModelName.cs
|
|||||||
src/Org.OpenAPITools/Model/Tag.cs
|
src/Org.OpenAPITools/Model/Tag.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/TestDescendants.cs
|
||||||
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
|
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
|
||||||
src/Org.OpenAPITools/Model/TestResult.cs
|
src/Org.OpenAPITools/Model/TestResult.cs
|
||||||
src/Org.OpenAPITools/Model/TestResultCode.cs
|
src/Org.OpenAPITools/Model/TestResultCode.cs
|
||||||
|
@ -2770,6 +2770,40 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
Descendant1:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
descendantName:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- descendantName
|
||||||
|
type: object
|
||||||
|
Descendant2:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
confidentiality:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- confidentiality
|
||||||
|
type: object
|
||||||
|
TestDescendants:
|
||||||
|
description: ""
|
||||||
|
discriminator:
|
||||||
|
propertyName: objectType
|
||||||
|
properties:
|
||||||
|
alternativeName:
|
||||||
|
type: string
|
||||||
|
objectType:
|
||||||
|
enum:
|
||||||
|
- Descendant1
|
||||||
|
- Descendant2
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- alternativeName
|
||||||
|
- objectType
|
||||||
|
type: object
|
||||||
CopyActivity:
|
CopyActivity:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/EntityBase'
|
- $ref: '#/components/schemas/EntityBase'
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant1
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **string** | |
|
||||||
|
**DescendantName** | **string** | |
|
||||||
|
|
||||||
|
[[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,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant2
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **string** | |
|
||||||
|
**Confidentiality** | **string** | |
|
||||||
|
|
||||||
|
[[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,11 @@
|
|||||||
|
# Org.OpenAPITools.Model.TestDescendants
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **string** | |
|
||||||
|
|
||||||
|
[[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,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant1
|
||||||
|
/// </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 Descendant1Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant1
|
||||||
|
//private Descendant1 instance;
|
||||||
|
|
||||||
|
public Descendant1Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant1
|
||||||
|
//instance = new Descendant1();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant1
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant1
|
||||||
|
//Assert.IsType<Descendant1>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'DescendantName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void DescendantNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'DescendantName'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant2
|
||||||
|
/// </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 Descendant2Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant2
|
||||||
|
//private Descendant2 instance;
|
||||||
|
|
||||||
|
public Descendant2Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant2
|
||||||
|
//instance = new Descendant2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant2
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant2
|
||||||
|
//Assert.IsType<Descendant2>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'Confidentiality'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ConfidentialityTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'Confidentiality'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing TestDescendants
|
||||||
|
/// </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 TestDescendantsTests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for TestDescendants
|
||||||
|
//private TestDescendants instance;
|
||||||
|
|
||||||
|
public TestDescendantsTests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of TestDescendants
|
||||||
|
//instance = new TestDescendants();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestDescendantsInstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant1 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant1 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant1().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant2 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant2 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant2().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'AlternativeName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void AlternativeNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'AlternativeName'
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'ObjectType'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ObjectTypeTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'ObjectType'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -227,6 +227,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
|
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
|
||||||
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
|
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
|
||||||
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
|
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
|
||||||
|
if (obj is TestDescendants.ObjectTypeEnum testDescendantsObjectTypeEnum)
|
||||||
|
return TestDescendants.ObjectTypeEnumToJsonValue(testDescendantsObjectTypeEnum);
|
||||||
if (obj is TestResultCode testResultCode)
|
if (obj is TestResultCode testResultCode)
|
||||||
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
|
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
|
||||||
if (obj is Zebra.TypeEnum zebraTypeEnum)
|
if (obj is Zebra.TypeEnum zebraTypeEnum)
|
||||||
|
@ -62,6 +62,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant1JsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant2JsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DogJsonConverter());
|
_jsonOptions.Converters.Add(new DogJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
||||||
@ -135,6 +137,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new TagJsonConverter());
|
_jsonOptions.Converters.Add(new TagJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
|
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestResultJsonConverter());
|
_jsonOptions.Converters.Add(new TestResultJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
|
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Animal(Option<string> color = default)
|
public Animal(Option<string> color = default)
|
||||||
{
|
{
|
||||||
|
ClassName = this.GetType().Name;
|
||||||
ColorOption = color;
|
ColorOption = color;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string ClassName { get; } = "Animal";
|
public string ClassName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Color
|
/// Used to track the state of Color
|
||||||
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Cat";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Declawed
|
/// Used to track the state of Declawed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -37,6 +37,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
public ChildCat(Option<string> name = default) : base()
|
public ChildCat(Option<string> name = default) : base()
|
||||||
{
|
{
|
||||||
NameOption = name;
|
NameOption = name;
|
||||||
|
PetType = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), this.GetType().Name);
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new PetTypeEnum PetType { get; } = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), "ChildCat");
|
public new PetTypeEnum PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public CopyActivity(string copyActivitytt) : base()
|
public CopyActivity(string copyActivitytt) : base()
|
||||||
{
|
{
|
||||||
|
Schema = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), this.GetType().Name);
|
||||||
CopyActivitytt = copyActivitytt;
|
CopyActivitytt = copyActivitytt;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
|
public new SchemaEnum Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets CopyActivitytt
|
/// Gets or Sets CopyActivitytt
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant1
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant1 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant1" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="descendantName">descendantName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant1(string alternativeName, string descendantName) : base(alternativeName)
|
||||||
|
{
|
||||||
|
DescendantName = descendantName;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets DescendantName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("descendantName")]
|
||||||
|
public string DescendantName { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant1 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" DescendantName: ").Append(DescendantName).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant1JsonConverter : JsonConverter<Descendant1>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant1 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> descendantName = default;
|
||||||
|
Option<Descendant1.ObjectTypeEnum?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "descendantName":
|
||||||
|
descendantName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<Descendant1.ObjectTypeEnum?>(Descendant1.ObjectTypeEnumFromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!descendantName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(descendantName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendantName.IsSet && descendantName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendantName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
return new Descendant1(alternativeName.Value, descendantName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant1, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant1.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendant1.DescendantName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant1.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("descendantName", descendant1.DescendantName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", Descendant1.ObjectTypeEnumToJsonValue(descendant1.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant2
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant2 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant2" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="confidentiality">confidentiality</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant2(string alternativeName, string confidentiality) : base(alternativeName)
|
||||||
|
{
|
||||||
|
Confidentiality = confidentiality;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets Confidentiality
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("confidentiality")]
|
||||||
|
public string Confidentiality { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant2 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" Confidentiality: ").Append(Confidentiality).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant2JsonConverter : JsonConverter<Descendant2>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant2 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> confidentiality = default;
|
||||||
|
Option<Descendant2.ObjectTypeEnum?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "confidentiality":
|
||||||
|
confidentiality = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<Descendant2.ObjectTypeEnum?>(Descendant2.ObjectTypeEnumFromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!confidentiality.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(confidentiality));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (confidentiality.IsSet && confidentiality.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(confidentiality), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
return new Descendant2(alternativeName.Value, confidentiality.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant2, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant2.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
if (descendant2.Confidentiality == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant2.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("confidentiality", descendant2.Confidentiality);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", Descendant2.ObjectTypeEnumToJsonValue(descendant2.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Dog";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Breed
|
/// Used to track the state of Breed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public EntityBase()
|
public EntityBase()
|
||||||
{
|
{
|
||||||
|
Schema = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string Schema { get; } = "EntityBase";
|
public string Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public GrandparentAnimal()
|
public GrandparentAnimal()
|
||||||
{
|
{
|
||||||
|
PetType = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string PetType { get; } = "GrandparentAnimal";
|
public string PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -40,13 +40,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string PetType { get; } = "ParentPet";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -0,0 +1,285 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
public partial class TestDescendants : IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TestDescendants" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public TestDescendants(string alternativeName)
|
||||||
|
{
|
||||||
|
AlternativeName = alternativeName;
|
||||||
|
ObjectType = (ObjectTypeEnum)Enum.Parse(typeof(ObjectTypeEnum), this.GetType().Name);
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines ObjectType
|
||||||
|
/// </summary>
|
||||||
|
public enum ObjectTypeEnum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Descendant1 for value: Descendant1
|
||||||
|
/// </summary>
|
||||||
|
Descendant1 = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Descendant2 for value: Descendant2
|
||||||
|
/// </summary>
|
||||||
|
Descendant2 = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a <see cref="ObjectTypeEnum"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public static ObjectTypeEnum ObjectTypeEnumFromString(string value)
|
||||||
|
{
|
||||||
|
if (value.Equals("Descendant1"))
|
||||||
|
return ObjectTypeEnum.Descendant1;
|
||||||
|
|
||||||
|
if (value.Equals("Descendant2"))
|
||||||
|
return ObjectTypeEnum.Descendant2;
|
||||||
|
|
||||||
|
throw new NotImplementedException($"Could not convert value to type ObjectTypeEnum: '{value}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a <see cref="ObjectTypeEnum"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static ObjectTypeEnum? ObjectTypeEnumFromStringOrDefault(string value)
|
||||||
|
{
|
||||||
|
if (value.Equals("Descendant1"))
|
||||||
|
return ObjectTypeEnum.Descendant1;
|
||||||
|
|
||||||
|
if (value.Equals("Descendant2"))
|
||||||
|
return ObjectTypeEnum.Descendant2;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the <see cref="ObjectTypeEnum"/> to the json value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public static string ObjectTypeEnumToJsonValue(ObjectTypeEnum value)
|
||||||
|
{
|
||||||
|
if (value == ObjectTypeEnum.Descendant1)
|
||||||
|
return "Descendant1";
|
||||||
|
|
||||||
|
if (value == ObjectTypeEnum.Descendant2)
|
||||||
|
return "Descendant2";
|
||||||
|
|
||||||
|
throw new NotImplementedException($"Value could not be handled: '{value}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets AlternativeName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("alternativeName")]
|
||||||
|
public string AlternativeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public ObjectTypeEnum ObjectType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets additional properties
|
||||||
|
/// </summary>
|
||||||
|
[JsonExtensionData]
|
||||||
|
public Dictionary<string, JsonElement> AdditionalProperties { get; } = 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 TestDescendants {\n");
|
||||||
|
sb.Append(" AlternativeName: ").Append(AlternativeName).Append("\n");
|
||||||
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
public class TestDescendantsJsonConverter : JsonConverter<TestDescendants>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override TestDescendants Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<TestDescendants.ObjectTypeEnum?> objectType = default;
|
||||||
|
|
||||||
|
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "objectType");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Descendant1"))
|
||||||
|
return JsonSerializer.Deserialize<Descendant1>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Descendant2"))
|
||||||
|
return JsonSerializer.Deserialize<Descendant2>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendants.ObjectTypeEnum?>(TestDescendants.ObjectTypeEnumFromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class TestDescendants.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class TestDescendants.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class TestDescendants.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class TestDescendants.");
|
||||||
|
|
||||||
|
return new TestDescendants(alternativeName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendants"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (testDescendants is Descendant1 descendant1){
|
||||||
|
JsonSerializer.Serialize<Descendant1>(writer, descendant1, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testDescendants is Descendant2 descendant2){
|
||||||
|
JsonSerializer.Serialize<Descendant2>(writer, descendant2, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, testDescendants, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendants"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (testDescendants.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", testDescendants.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -57,13 +57,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonPropertyName("children")]
|
[JsonPropertyName("children")]
|
||||||
public List<Child> Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new Option<List<Child>>(value); } }
|
public List<Child> Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new Option<List<Child>>(value); } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string Type { get; } = "Adult";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -59,13 +59,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonPropertyName("age")]
|
[JsonPropertyName("age")]
|
||||||
public int? Age { get { return this.AgeOption; } set { this.AgeOption = new Option<int?>(value); } }
|
public int? Age { get { return this.AgeOption; } set { this.AgeOption = new Option<int?>(value); } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string Type { get; } = "Child";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of BoosterSeat
|
/// Used to track the state of BoosterSeat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -39,6 +39,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
FirstNameOption = firstName;
|
FirstNameOption = firstName;
|
||||||
LastNameOption = lastName;
|
LastNameOption = lastName;
|
||||||
|
Type = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string Type { get; } = "Person";
|
public string Type { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -34,6 +34,8 @@ docs/models/CopyActivity.md
|
|||||||
docs/models/DanishPig.md
|
docs/models/DanishPig.md
|
||||||
docs/models/DateOnlyClass.md
|
docs/models/DateOnlyClass.md
|
||||||
docs/models/DeprecatedObject.md
|
docs/models/DeprecatedObject.md
|
||||||
|
docs/models/Descendant1.md
|
||||||
|
docs/models/Descendant2.md
|
||||||
docs/models/Dog.md
|
docs/models/Dog.md
|
||||||
docs/models/Drawing.md
|
docs/models/Drawing.md
|
||||||
docs/models/EntityBase.md
|
docs/models/EntityBase.md
|
||||||
@ -116,6 +118,8 @@ docs/models/SpecialModelName.md
|
|||||||
docs/models/Tag.md
|
docs/models/Tag.md
|
||||||
docs/models/TestCollectionEndingWithWordList.md
|
docs/models/TestCollectionEndingWithWordList.md
|
||||||
docs/models/TestCollectionEndingWithWordListObject.md
|
docs/models/TestCollectionEndingWithWordListObject.md
|
||||||
|
docs/models/TestDescendants.md
|
||||||
|
docs/models/TestDescendantsObjectType.md
|
||||||
docs/models/TestEnumParametersEnumHeaderStringParameter.md
|
docs/models/TestEnumParametersEnumHeaderStringParameter.md
|
||||||
docs/models/TestEnumParametersEnumQueryDoubleParameter.md
|
docs/models/TestEnumParametersEnumQueryDoubleParameter.md
|
||||||
docs/models/TestEnumParametersEnumQueryIntegerParameter.md
|
docs/models/TestEnumParametersEnumQueryIntegerParameter.md
|
||||||
@ -195,6 +199,8 @@ src/Org.OpenAPITools/Model/CopyActivity.cs
|
|||||||
src/Org.OpenAPITools/Model/DanishPig.cs
|
src/Org.OpenAPITools/Model/DanishPig.cs
|
||||||
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
||||||
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant1.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant2.cs
|
||||||
src/Org.OpenAPITools/Model/Dog.cs
|
src/Org.OpenAPITools/Model/Dog.cs
|
||||||
src/Org.OpenAPITools/Model/Drawing.cs
|
src/Org.OpenAPITools/Model/Drawing.cs
|
||||||
src/Org.OpenAPITools/Model/EntityBase.cs
|
src/Org.OpenAPITools/Model/EntityBase.cs
|
||||||
@ -277,6 +283,8 @@ src/Org.OpenAPITools/Model/SpecialModelName.cs
|
|||||||
src/Org.OpenAPITools/Model/Tag.cs
|
src/Org.OpenAPITools/Model/Tag.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/TestDescendants.cs
|
||||||
|
src/Org.OpenAPITools/Model/TestDescendantsObjectType.cs
|
||||||
src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs
|
src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs
|
||||||
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs
|
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs
|
||||||
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
|
src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
|
||||||
|
@ -2592,6 +2592,37 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
Descendant1:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
descendantName:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- descendantName
|
||||||
|
type: object
|
||||||
|
Descendant2:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
confidentiality:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- confidentiality
|
||||||
|
type: object
|
||||||
|
TestDescendants:
|
||||||
|
description: ""
|
||||||
|
discriminator:
|
||||||
|
propertyName: objectType
|
||||||
|
properties:
|
||||||
|
alternativeName:
|
||||||
|
type: string
|
||||||
|
objectType:
|
||||||
|
$ref: '#/components/schemas/TestDescendants_objectType'
|
||||||
|
required:
|
||||||
|
- alternativeName
|
||||||
|
- objectType
|
||||||
|
type: object
|
||||||
CopyActivity:
|
CopyActivity:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/EntityBase'
|
- $ref: '#/components/schemas/EntityBase'
|
||||||
@ -2984,6 +3015,11 @@ components:
|
|||||||
type: number
|
type: number
|
||||||
- $ref: '#/components/schemas/MixedSubId'
|
- $ref: '#/components/schemas/MixedSubId'
|
||||||
description: Mixed anyOf types for testing
|
description: Mixed anyOf types for testing
|
||||||
|
TestDescendants_objectType:
|
||||||
|
enum:
|
||||||
|
- Descendant1
|
||||||
|
- Descendant2
|
||||||
|
type: string
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
petstore_auth:
|
petstore_auth:
|
||||||
flows:
|
flows:
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant1
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **TestDescendantsObjectType** | |
|
||||||
|
**DescendantName** | **string** | |
|
||||||
|
|
||||||
|
[[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,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant2
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **TestDescendantsObjectType** | |
|
||||||
|
**Confidentiality** | **string** | |
|
||||||
|
|
||||||
|
[[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,11 @@
|
|||||||
|
# Org.OpenAPITools.Model.TestDescendants
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **TestDescendantsObjectType** | |
|
||||||
|
|
||||||
|
[[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,9 @@
|
|||||||
|
# Org.OpenAPITools.Model.TestDescendantsObjectType
|
||||||
|
|
||||||
|
## 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,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant1
|
||||||
|
/// </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 Descendant1Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant1
|
||||||
|
//private Descendant1 instance;
|
||||||
|
|
||||||
|
public Descendant1Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant1
|
||||||
|
//instance = new Descendant1();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant1
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant1
|
||||||
|
//Assert.IsType<Descendant1>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'DescendantName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void DescendantNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'DescendantName'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant2
|
||||||
|
/// </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 Descendant2Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant2
|
||||||
|
//private Descendant2 instance;
|
||||||
|
|
||||||
|
public Descendant2Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant2
|
||||||
|
//instance = new Descendant2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant2
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant2
|
||||||
|
//Assert.IsType<Descendant2>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'Confidentiality'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ConfidentialityTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'Confidentiality'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing TestDescendantsObjectType
|
||||||
|
/// </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 TestDescendantsObjectTypeTests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for TestDescendantsObjectType
|
||||||
|
//private TestDescendantsObjectType instance;
|
||||||
|
|
||||||
|
public TestDescendantsObjectTypeTests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of TestDescendantsObjectType
|
||||||
|
//instance = new TestDescendantsObjectType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of TestDescendantsObjectType
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestDescendantsObjectTypeInstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" TestDescendantsObjectType
|
||||||
|
//Assert.IsType<TestDescendantsObjectType>(instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing TestDescendants
|
||||||
|
/// </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 TestDescendantsTests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for TestDescendants
|
||||||
|
//private TestDescendants instance;
|
||||||
|
|
||||||
|
public TestDescendantsTests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of TestDescendants
|
||||||
|
//instance = new TestDescendants();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestDescendantsInstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant1 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant1 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant1().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant2 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant2 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant2().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'AlternativeName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void AlternativeNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'AlternativeName'
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'ObjectType'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ObjectTypeTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'ObjectType'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -213,6 +213,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
return RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClassRequiredNullableEnumIntegerOnly).ToString();
|
return RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClassRequiredNullableEnumIntegerOnly).ToString();
|
||||||
if (obj is RequiredClassRequiredNullableEnumString requiredClassRequiredNullableEnumString)
|
if (obj is RequiredClassRequiredNullableEnumString requiredClassRequiredNullableEnumString)
|
||||||
return RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClassRequiredNullableEnumString);
|
return RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClassRequiredNullableEnumString);
|
||||||
|
if (obj is TestDescendantsObjectType testDescendantsObjectType)
|
||||||
|
return TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendantsObjectType);
|
||||||
if (obj is TestEnumParametersEnumHeaderStringParameter testEnumParametersEnumHeaderStringParameter)
|
if (obj is TestEnumParametersEnumHeaderStringParameter testEnumParametersEnumHeaderStringParameter)
|
||||||
return TestEnumParametersEnumHeaderStringParameterValueConverter.ToJsonValue(testEnumParametersEnumHeaderStringParameter);
|
return TestEnumParametersEnumHeaderStringParameterValueConverter.ToJsonValue(testEnumParametersEnumHeaderStringParameter);
|
||||||
if (obj is TestEnumParametersEnumQueryDoubleParameter testEnumParametersEnumQueryDoubleParameter)
|
if (obj is TestEnumParametersEnumQueryDoubleParameter testEnumParametersEnumQueryDoubleParameter)
|
||||||
|
@ -64,6 +64,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant1JsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant2JsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DogJsonConverter());
|
_jsonOptions.Converters.Add(new DogJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
||||||
@ -167,6 +169,9 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new TagJsonConverter());
|
_jsonOptions.Converters.Add(new TagJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsObjectTypeJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsObjectTypeNullableJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterJsonConverter());
|
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterNullableJsonConverter());
|
_jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterNullableJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestEnumParametersEnumQueryDoubleParameterJsonConverter());
|
_jsonOptions.Converters.Add(new TestEnumParametersEnumQueryDoubleParameterJsonConverter());
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Animal(Option<string> color = default)
|
public Animal(Option<string> color = default)
|
||||||
{
|
{
|
||||||
|
ClassName = this.GetType().Name;
|
||||||
ColorOption = color;
|
ColorOption = color;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string ClassName { get; } = "Animal";
|
public string ClassName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Color
|
/// Used to track the state of Color
|
||||||
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Cat";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Declawed
|
/// Used to track the state of Declawed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public ChildCat(Option<string> name = default) : base()
|
public ChildCat(Option<string> name = default) : base()
|
||||||
{
|
{
|
||||||
|
PetType = (ChildCatAllOfPetType)Enum.Parse(typeof(ChildCatAllOfPetType), this.GetType().Name);
|
||||||
NameOption = name;
|
NameOption = name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new ChildCatAllOfPetType PetType { get; } = (ChildCatAllOfPetType)Enum.Parse(typeof(ChildCatAllOfPetType), "ChildCat");
|
public new ChildCatAllOfPetType PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Name
|
/// Used to track the state of Name
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public CopyActivity(string copyActivitytt) : base()
|
public CopyActivity(string copyActivitytt) : base()
|
||||||
{
|
{
|
||||||
|
Schema = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), this.GetType().Name);
|
||||||
CopyActivitytt = copyActivitytt;
|
CopyActivitytt = copyActivitytt;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
|
public new SchemaEnum Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets CopyActivitytt
|
/// Gets or Sets CopyActivitytt
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant1
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant1 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant1" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="descendantName">descendantName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant1(string alternativeName, string descendantName) : base(alternativeName)
|
||||||
|
{
|
||||||
|
DescendantName = descendantName;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets DescendantName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("descendantName")]
|
||||||
|
public string DescendantName { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant1 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" DescendantName: ").Append(DescendantName).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant1JsonConverter : JsonConverter<Descendant1>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant1 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> descendantName = default;
|
||||||
|
Option<TestDescendantsObjectType?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "descendantName":
|
||||||
|
descendantName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendantsObjectType?>(TestDescendantsObjectTypeValueConverter.FromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!descendantName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(descendantName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendantName.IsSet && descendantName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendantName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
return new Descendant1(alternativeName.Value, descendantName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant1, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant1.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendant1.DescendantName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant1.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("descendantName", descendant1.DescendantName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(descendant1.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant2
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant2 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant2" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="confidentiality">confidentiality</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant2(string alternativeName, string confidentiality) : base(alternativeName)
|
||||||
|
{
|
||||||
|
Confidentiality = confidentiality;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets Confidentiality
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("confidentiality")]
|
||||||
|
public string Confidentiality { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant2 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" Confidentiality: ").Append(Confidentiality).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant2JsonConverter : JsonConverter<Descendant2>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant2 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> confidentiality = default;
|
||||||
|
Option<TestDescendantsObjectType?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "confidentiality":
|
||||||
|
confidentiality = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendantsObjectType?>(TestDescendantsObjectTypeValueConverter.FromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!confidentiality.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(confidentiality));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (confidentiality.IsSet && confidentiality.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(confidentiality), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
return new Descendant2(alternativeName.Value, confidentiality.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant2, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant2.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
if (descendant2.Confidentiality == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant2.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("confidentiality", descendant2.Confidentiality);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(descendant2.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Dog";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Breed
|
/// Used to track the state of Breed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public EntityBase()
|
public EntityBase()
|
||||||
{
|
{
|
||||||
|
Schema = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string Schema { get; } = "EntityBase";
|
public string Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public GrandparentAnimal()
|
public GrandparentAnimal()
|
||||||
{
|
{
|
||||||
|
PetType = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string PetType { get; } = "GrandparentAnimal";
|
public string PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -40,13 +40,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string PetType { get; } = "ParentPet";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -0,0 +1,219 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
public partial class TestDescendants : IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TestDescendants" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public TestDescendants(string alternativeName)
|
||||||
|
{
|
||||||
|
AlternativeName = alternativeName;
|
||||||
|
ObjectType = (TestDescendantsObjectType)Enum.Parse(typeof(TestDescendantsObjectType), this.GetType().Name);
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets AlternativeName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("alternativeName")]
|
||||||
|
public string AlternativeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public TestDescendantsObjectType ObjectType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets additional properties
|
||||||
|
/// </summary>
|
||||||
|
[JsonExtensionData]
|
||||||
|
public Dictionary<string, JsonElement> AdditionalProperties { get; } = 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 TestDescendants {\n");
|
||||||
|
sb.Append(" AlternativeName: ").Append(AlternativeName).Append("\n");
|
||||||
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
return this.BaseValidate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To validate all properties of the instance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="validationContext">Validation context</param>
|
||||||
|
/// <returns>Validation Result</returns>
|
||||||
|
protected IEnumerable<ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
public class TestDescendantsJsonConverter : JsonConverter<TestDescendants>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override TestDescendants Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<TestDescendantsObjectType?> objectType = default;
|
||||||
|
|
||||||
|
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "objectType");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Descendant1"))
|
||||||
|
return JsonSerializer.Deserialize<Descendant1>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Descendant2"))
|
||||||
|
return JsonSerializer.Deserialize<Descendant2>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<TestDescendantsObjectType?>(TestDescendantsObjectTypeValueConverter.FromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class TestDescendants.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class TestDescendants.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class TestDescendants.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class TestDescendants.");
|
||||||
|
|
||||||
|
return new TestDescendants(alternativeName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendants"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (testDescendants is Descendant1 descendant1){
|
||||||
|
JsonSerializer.Serialize<Descendant1>(writer, descendant1, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testDescendants is Descendant2 descendant2){
|
||||||
|
JsonSerializer.Serialize<Descendant2>(writer, descendant2, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, testDescendants, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="TestDescendants" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendants"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (testDescendants.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", testDescendants.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,174 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines TestDescendants_objectType
|
||||||
|
/// </summary>
|
||||||
|
public enum TestDescendantsObjectType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Descendant1 for value: Descendant1
|
||||||
|
/// </summary>
|
||||||
|
Descendant1 = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Descendant2 for value: Descendant2
|
||||||
|
/// </summary>
|
||||||
|
Descendant2 = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts <see cref="TestDescendantsObjectType"/> to and from the JSON value
|
||||||
|
/// </summary>
|
||||||
|
public static class TestDescendantsObjectTypeValueConverter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a given value to <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TestDescendantsObjectType FromString(string value)
|
||||||
|
{
|
||||||
|
if (value.Equals("Descendant1"))
|
||||||
|
return TestDescendantsObjectType.Descendant1;
|
||||||
|
|
||||||
|
if (value.Equals("Descendant2"))
|
||||||
|
return TestDescendantsObjectType.Descendant2;
|
||||||
|
|
||||||
|
throw new NotImplementedException($"Could not convert value to type TestDescendantsObjectType: '{value}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a given value to <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TestDescendantsObjectType? FromStringOrDefault(string value)
|
||||||
|
{
|
||||||
|
if (value.Equals("Descendant1"))
|
||||||
|
return TestDescendantsObjectType.Descendant1;
|
||||||
|
|
||||||
|
if (value.Equals("Descendant2"))
|
||||||
|
return TestDescendantsObjectType.Descendant2;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the <see cref="TestDescendantsObjectType"/> to the json value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public static string ToJsonValue(TestDescendantsObjectType value)
|
||||||
|
{
|
||||||
|
if (value == TestDescendantsObjectType.Descendant1)
|
||||||
|
return "Descendant1";
|
||||||
|
|
||||||
|
if (value == TestDescendantsObjectType.Descendant2)
|
||||||
|
return "Descendant2";
|
||||||
|
|
||||||
|
throw new NotImplementedException($"Value could not be handled: '{value}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public class TestDescendantsObjectTypeJsonConverter : JsonConverter<TestDescendantsObjectType>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a from the Json object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override TestDescendantsObjectType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
string rawValue = reader.GetString();
|
||||||
|
|
||||||
|
TestDescendantsObjectType? result = rawValue == null
|
||||||
|
? null
|
||||||
|
: TestDescendantsObjectTypeValueConverter.FromStringOrDefault(rawValue);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
return result.Value;
|
||||||
|
|
||||||
|
throw new JsonException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the TestDescendantsObjectType to the json writer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendantsObjectType"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendantsObjectType testDescendantsObjectType, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(testDescendantsObjectType.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="TestDescendantsObjectType"/>
|
||||||
|
/// </summary>
|
||||||
|
public class TestDescendantsObjectTypeNullableJsonConverter : JsonConverter<TestDescendantsObjectType?>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a TestDescendantsObjectType from the Json object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override TestDescendantsObjectType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
string rawValue = reader.GetString();
|
||||||
|
|
||||||
|
TestDescendantsObjectType? result = rawValue == null
|
||||||
|
? null
|
||||||
|
: TestDescendantsObjectTypeValueConverter.FromStringOrDefault(rawValue);
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
return result.Value;
|
||||||
|
|
||||||
|
throw new JsonException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the DateTime to the json writer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="testDescendantsObjectType"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
public override void Write(Utf8JsonWriter writer, TestDescendantsObjectType? testDescendantsObjectType, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(testDescendantsObjectType?.ToString() ?? "null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,8 @@ docs/models/CopyActivity.md
|
|||||||
docs/models/DanishPig.md
|
docs/models/DanishPig.md
|
||||||
docs/models/DateOnlyClass.md
|
docs/models/DateOnlyClass.md
|
||||||
docs/models/DeprecatedObject.md
|
docs/models/DeprecatedObject.md
|
||||||
|
docs/models/Descendant1.md
|
||||||
|
docs/models/Descendant2.md
|
||||||
docs/models/Dog.md
|
docs/models/Dog.md
|
||||||
docs/models/Drawing.md
|
docs/models/Drawing.md
|
||||||
docs/models/EntityBase.md
|
docs/models/EntityBase.md
|
||||||
@ -100,6 +102,7 @@ docs/models/SpecialModelName.md
|
|||||||
docs/models/Tag.md
|
docs/models/Tag.md
|
||||||
docs/models/TestCollectionEndingWithWordList.md
|
docs/models/TestCollectionEndingWithWordList.md
|
||||||
docs/models/TestCollectionEndingWithWordListObject.md
|
docs/models/TestCollectionEndingWithWordListObject.md
|
||||||
|
docs/models/TestDescendants.md
|
||||||
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
docs/models/TestResult.md
|
docs/models/TestResult.md
|
||||||
docs/models/TestResultCode.md
|
docs/models/TestResultCode.md
|
||||||
@ -171,6 +174,8 @@ src/Org.OpenAPITools/Model/CopyActivity.cs
|
|||||||
src/Org.OpenAPITools/Model/DanishPig.cs
|
src/Org.OpenAPITools/Model/DanishPig.cs
|
||||||
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
src/Org.OpenAPITools/Model/DateOnlyClass.cs
|
||||||
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
src/Org.OpenAPITools/Model/DeprecatedObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant1.cs
|
||||||
|
src/Org.OpenAPITools/Model/Descendant2.cs
|
||||||
src/Org.OpenAPITools/Model/Dog.cs
|
src/Org.OpenAPITools/Model/Dog.cs
|
||||||
src/Org.OpenAPITools/Model/Drawing.cs
|
src/Org.OpenAPITools/Model/Drawing.cs
|
||||||
src/Org.OpenAPITools/Model/EntityBase.cs
|
src/Org.OpenAPITools/Model/EntityBase.cs
|
||||||
@ -238,6 +243,7 @@ src/Org.OpenAPITools/Model/SpecialModelName.cs
|
|||||||
src/Org.OpenAPITools/Model/Tag.cs
|
src/Org.OpenAPITools/Model/Tag.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
|
||||||
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
|
||||||
|
src/Org.OpenAPITools/Model/TestDescendants.cs
|
||||||
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
|
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
|
||||||
src/Org.OpenAPITools/Model/TestResult.cs
|
src/Org.OpenAPITools/Model/TestResult.cs
|
||||||
src/Org.OpenAPITools/Model/TestResultCode.cs
|
src/Org.OpenAPITools/Model/TestResultCode.cs
|
||||||
|
@ -2770,6 +2770,40 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
Descendant1:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
descendantName:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- descendantName
|
||||||
|
type: object
|
||||||
|
Descendant2:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TestDescendants'
|
||||||
|
- properties:
|
||||||
|
confidentiality:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- confidentiality
|
||||||
|
type: object
|
||||||
|
TestDescendants:
|
||||||
|
description: ""
|
||||||
|
discriminator:
|
||||||
|
propertyName: objectType
|
||||||
|
properties:
|
||||||
|
alternativeName:
|
||||||
|
type: string
|
||||||
|
objectType:
|
||||||
|
enum:
|
||||||
|
- Descendant1
|
||||||
|
- Descendant2
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- alternativeName
|
||||||
|
- objectType
|
||||||
|
type: object
|
||||||
CopyActivity:
|
CopyActivity:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/EntityBase'
|
- $ref: '#/components/schemas/EntityBase'
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant1
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **string** | |
|
||||||
|
**DescendantName** | **string** | |
|
||||||
|
|
||||||
|
[[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,12 @@
|
|||||||
|
# Org.OpenAPITools.Model.Descendant2
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **string** | |
|
||||||
|
**Confidentiality** | **string** | |
|
||||||
|
|
||||||
|
[[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,11 @@
|
|||||||
|
# Org.OpenAPITools.Model.TestDescendants
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AlternativeName** | **string** | |
|
||||||
|
**ObjectType** | **string** | |
|
||||||
|
|
||||||
|
[[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,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant1
|
||||||
|
/// </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 Descendant1Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant1
|
||||||
|
//private Descendant1 instance;
|
||||||
|
|
||||||
|
public Descendant1Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant1
|
||||||
|
//instance = new Descendant1();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant1
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant1
|
||||||
|
//Assert.IsType<Descendant1>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'DescendantName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void DescendantNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'DescendantName'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing Descendant2
|
||||||
|
/// </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 Descendant2Tests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for Descendant2
|
||||||
|
//private Descendant2 instance;
|
||||||
|
|
||||||
|
public Descendant2Tests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of Descendant2
|
||||||
|
//instance = new Descendant2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of Descendant2
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2InstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" Descendant2
|
||||||
|
//Assert.IsType<Descendant2>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'Confidentiality'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ConfidentialityTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'Confidentiality'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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.Model;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Test.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class for testing TestDescendants
|
||||||
|
/// </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 TestDescendantsTests : IDisposable
|
||||||
|
{
|
||||||
|
// TODO uncomment below to declare an instance variable for TestDescendants
|
||||||
|
//private TestDescendants instance;
|
||||||
|
|
||||||
|
public TestDescendantsTests()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to create an instance of TestDescendants
|
||||||
|
//instance = new TestDescendants();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Cleanup when everything is done.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test an instance of TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestDescendantsInstanceTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test "IsType" TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant1 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant1DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant1 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant1().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialize a Descendant2 from type TestDescendants
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void Descendant2DeserializeFromTestDescendantsTest()
|
||||||
|
{
|
||||||
|
// TODO uncomment below to test deserialize a Descendant2 from type TestDescendants
|
||||||
|
//Assert.IsType<TestDescendants>(JsonConvert.DeserializeObject<TestDescendants>(new Descendant2().ToJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'AlternativeName'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void AlternativeNameTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'AlternativeName'
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the property 'ObjectType'
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ObjectTypeTest()
|
||||||
|
{
|
||||||
|
// TODO unit test for the property 'ObjectType'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -227,6 +227,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
|
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
|
||||||
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
|
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
|
||||||
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
|
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
|
||||||
|
if (obj is TestDescendants.ObjectTypeEnum testDescendantsObjectTypeEnum)
|
||||||
|
return TestDescendants.ObjectTypeEnumToJsonValue(testDescendantsObjectTypeEnum);
|
||||||
if (obj is TestResultCode testResultCode)
|
if (obj is TestResultCode testResultCode)
|
||||||
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
|
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
|
||||||
if (obj is Zebra.TypeEnum zebraTypeEnum)
|
if (obj is Zebra.TypeEnum zebraTypeEnum)
|
||||||
|
@ -62,6 +62,8 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant1JsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new Descendant2JsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DogJsonConverter());
|
_jsonOptions.Converters.Add(new DogJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
_jsonOptions.Converters.Add(new DrawingJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
|
||||||
@ -135,6 +137,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
_jsonOptions.Converters.Add(new TagJsonConverter());
|
_jsonOptions.Converters.Add(new TagJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
|
||||||
|
_jsonOptions.Converters.Add(new TestDescendantsJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
|
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestResultJsonConverter());
|
_jsonOptions.Converters.Add(new TestResultJsonConverter());
|
||||||
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
|
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Animal(Option<string> color = default)
|
public Animal(Option<string> color = default)
|
||||||
{
|
{
|
||||||
|
ClassName = this.GetType().Name;
|
||||||
ColorOption = color;
|
ColorOption = color;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string ClassName { get; } = "Animal";
|
public string ClassName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Color
|
/// Used to track the state of Color
|
||||||
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Cat";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Declawed
|
/// Used to track the state of Declawed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -37,6 +37,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
public ChildCat(Option<string> name = default) : base()
|
public ChildCat(Option<string> name = default) : base()
|
||||||
{
|
{
|
||||||
NameOption = name;
|
NameOption = name;
|
||||||
|
PetType = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), this.GetType().Name);
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new PetTypeEnum PetType { get; } = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), "ChildCat");
|
public new PetTypeEnum PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
|
@ -36,6 +36,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public CopyActivity(string copyActivitytt) : base()
|
public CopyActivity(string copyActivitytt) : base()
|
||||||
{
|
{
|
||||||
|
Schema = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), this.GetType().Name);
|
||||||
CopyActivitytt = copyActivitytt;
|
CopyActivitytt = copyActivitytt;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
|
public new SchemaEnum Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets CopyActivitytt
|
/// Gets or Sets CopyActivitytt
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant1
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant1 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant1" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="descendantName">descendantName</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant1(string alternativeName, string descendantName) : base(alternativeName)
|
||||||
|
{
|
||||||
|
DescendantName = descendantName;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets DescendantName
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("descendantName")]
|
||||||
|
public string DescendantName { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant1 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" DescendantName: ").Append(DescendantName).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant1JsonConverter : JsonConverter<Descendant1>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant1 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> descendantName = default;
|
||||||
|
Option<Descendant1.ObjectTypeEnum?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "descendantName":
|
||||||
|
descendantName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<Descendant1.ObjectTypeEnum?>(Descendant1.ObjectTypeEnumFromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!descendantName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(descendantName));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant1.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendantName.IsSet && descendantName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendantName), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant1.");
|
||||||
|
|
||||||
|
return new Descendant1(alternativeName.Value, descendantName.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant1, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant1" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant1"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant1.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
if (descendant1.DescendantName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant1.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("descendantName", descendant1.DescendantName);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", Descendant1.ObjectTypeEnumToJsonValue(descendant1.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
// <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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||||
|
using Org.OpenAPITools.Client;
|
||||||
|
|
||||||
|
namespace Org.OpenAPITools.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Descendant2
|
||||||
|
/// </summary>
|
||||||
|
public partial class Descendant2 : TestDescendants, IValidatableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Descendant2" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alternativeName">alternativeName</param>
|
||||||
|
/// <param name="confidentiality">confidentiality</param>
|
||||||
|
[JsonConstructor]
|
||||||
|
public Descendant2(string alternativeName, string confidentiality) : base(alternativeName)
|
||||||
|
{
|
||||||
|
Confidentiality = confidentiality;
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets Confidentiality
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("confidentiality")]
|
||||||
|
public string Confidentiality { get; set; }
|
||||||
|
|
||||||
|
/// <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 Descendant2 {\n");
|
||||||
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
|
sb.Append(" Confidentiality: ").Append(Confidentiality).Append("\n");
|
||||||
|
sb.Append("}\n");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Json converter for type <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
public class Descendant2JsonConverter : JsonConverter<Descendant2>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes json to <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="typeToConvert"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public override Descendant2 Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
Option<string> alternativeName = default;
|
||||||
|
Option<string> confidentiality = default;
|
||||||
|
Option<Descendant2.ObjectTypeEnum?> objectType = default;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
switch (localVarJsonPropertyName)
|
||||||
|
{
|
||||||
|
case "alternativeName":
|
||||||
|
alternativeName = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "confidentiality":
|
||||||
|
confidentiality = new Option<string>(utf8JsonReader.GetString());
|
||||||
|
break;
|
||||||
|
case "objectType":
|
||||||
|
string objectTypeRawValue = utf8JsonReader.GetString();
|
||||||
|
if (objectTypeRawValue != null)
|
||||||
|
objectType = new Option<Descendant2.ObjectTypeEnum?>(Descendant2.ObjectTypeEnumFromStringOrDefault(objectTypeRawValue));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alternativeName.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(alternativeName));
|
||||||
|
|
||||||
|
if (!confidentiality.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(confidentiality));
|
||||||
|
|
||||||
|
if (!objectType.IsSet)
|
||||||
|
throw new ArgumentException("Property is required for class Descendant2.", nameof(objectType));
|
||||||
|
|
||||||
|
if (alternativeName.IsSet && alternativeName.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(alternativeName), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (confidentiality.IsSet && confidentiality.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(confidentiality), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
if (objectType.IsSet && objectType.Value == null)
|
||||||
|
throw new ArgumentNullException(nameof(objectType), "Property is not nullable for class Descendant2.");
|
||||||
|
|
||||||
|
return new Descendant2(alternativeName.Value, confidentiality.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes a <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
WriteProperties(writer, descendant2, jsonSerializerOptions);
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the properties of <see cref="Descendant2" />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer"></param>
|
||||||
|
/// <param name="descendant2"></param>
|
||||||
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions)
|
||||||
|
{
|
||||||
|
if (descendant2.AlternativeName == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
if (descendant2.Confidentiality == null)
|
||||||
|
throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2.");
|
||||||
|
|
||||||
|
writer.WriteString("alternativeName", descendant2.AlternativeName);
|
||||||
|
|
||||||
|
writer.WriteString("confidentiality", descendant2.Confidentiality);
|
||||||
|
|
||||||
|
writer.WriteString("objectType", Descendant2.ObjectTypeEnumToJsonValue(descendant2.ObjectType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -43,13 +43,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The discriminator
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public new string ClassName { get; } = "Dog";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Breed
|
/// Used to track the state of Breed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public EntityBase()
|
public EntityBase()
|
||||||
{
|
{
|
||||||
|
Schema = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string Schema { get; } = "EntityBase";
|
public string Schema { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public GrandparentAnimal()
|
public GrandparentAnimal()
|
||||||
{
|
{
|
||||||
|
PetType = this.GetType().Name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public string PetType { get; } = "GrandparentAnimal";
|
public string PetType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user