[csharp][generichost] Fixes de/serialization (#20540)

* fixed json serializer

* build samples
This commit is contained in:
devhl-labs 2025-01-26 09:18:11 -05:00 committed by GitHub
parent b033219c54
commit f1c1567aa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
186 changed files with 11210 additions and 2 deletions

View File

@ -51,7 +51,7 @@
{{/-first}}
if (discriminator != null && discriminator.Equals("{{name}}"))
return JsonSerializer.Deserialize<{{{name}}}>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
return JsonSerializer.Deserialize<{{{classname}}}>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
{{/children}}
{{/discriminator}}
@ -348,7 +348,7 @@
{{#discriminator}}
{{#children}}
if ({{#lambda.paste}}{{/lambda.paste}} is {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}){
JsonSerializer.Serialize<{{{name}}}>(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
JsonSerializer.Serialize<{{{classname}}}>(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
return;
}

View File

@ -2938,3 +2938,28 @@ components:
uuid:
type: string
format: uuid
CopyActivity:
type: object
required:
- $schema
- copyActivitytt
properties:
$schema:
type: string
enum:
- ScopeActivity
copyActivitytt:
type: string
allOf:
- $ref: '#/components/schemas/EntityBase'
EntityBase:
type: object
required:
- $schema
properties:
$schema:
type: string
discriminator:
propertyName: $schema
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'

View File

@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@ -187,11 +189,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs

View File

@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -169,6 +169,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)

View File

@ -60,11 +60,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@ -163,11 +165,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs

View File

@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -169,6 +169,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)

View File

@ -58,11 +58,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@ -187,11 +189,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs

View File

@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -169,6 +169,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)

View File

@ -60,11 +60,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@ -163,11 +165,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs

View File

@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -169,6 +169,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)

View File

@ -58,11 +58,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@ -189,11 +191,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs

View File

@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -168,6 +168,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)

View File

@ -62,11 +62,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs

View File

@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -170,6 +170,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)

View File

@ -62,11 +62,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());

View File

@ -0,0 +1,228 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string?> copyActivitytt = 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 "$schema":
string? schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string?>(utf8JsonReader.GetString()!);
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value!);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,186 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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?> schema = default;
string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string?>(utf8JsonReader.GetString()!);
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs

View File

@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -168,6 +168,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)

View File

@ -60,11 +60,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs

View File

@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -170,6 +170,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)

View File

@ -62,11 +62,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
@ -169,11 +171,13 @@ namespace Org.OpenAPITools.Client
new ChildCatSerializationContext(),
new ClassModelSerializationContext(),
new ComplexQuadrilateralSerializationContext(),
new CopyActivitySerializationContext(),
new DanishPigSerializationContext(),
new DateOnlyClassSerializationContext(),
new DeprecatedObjectSerializationContext(),
new DogSerializationContext(),
new DrawingSerializationContext(),
new EntityBaseSerializationContext(),
new EnumArraysSerializationContext(),
new EnumClassSerializationContext(),
new EnumTestSerializationContext(),

View File

@ -0,0 +1,236 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.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 System.Text.Json.Serialization.Metadata;
using Org.OpenAPITools.Client;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string?> copyActivitytt = 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 "$schema":
string? schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string?>(utf8JsonReader.GetString()!);
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value!);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
/// <summary>
/// The CopyActivitySerializationContext
/// </summary>
[JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)]
[JsonSerializable(typeof(CopyActivity))]
public partial class CopyActivitySerializationContext : JsonSerializerContext { }
}

View File

@ -0,0 +1,194 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.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 System.Text.Json.Serialization.Metadata;
using Org.OpenAPITools.Client;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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?> schema = default;
string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string?>(utf8JsonReader.GetString()!);
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
/// <summary>
/// The EntityBaseSerializationContext
/// </summary>
[JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)]
[JsonSerializable(typeof(EntityBase))]
public partial class EntityBaseSerializationContext : JsonSerializerContext { }
}

View File

@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@ -189,11 +191,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs

View File

@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -168,6 +168,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)

View File

@ -62,11 +62,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());

View File

@ -0,0 +1,226 @@
// <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>
/// CopyActivity
/// </summary>
public partial class CopyActivity : EntityBase, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CopyActivity" /> class.
/// </summary>
/// <param name="copyActivitytt">copyActivitytt</param>
[JsonConstructor]
public CopyActivity(string copyActivitytt) : base()
{
CopyActivitytt = copyActivitytt;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Defines Schema
/// </summary>
public enum SchemaEnum
{
/// <summary>
/// Enum ScopeActivity for value: ScopeActivity
/// </summary>
ScopeActivity = 1
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static SchemaEnum SchemaEnumFromString(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
}
/// <summary>
/// Returns a <see cref="SchemaEnum"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
{
if (value.Equals("ScopeActivity"))
return SchemaEnum.ScopeActivity;
return null;
}
/// <summary>
/// Converts the <see cref="SchemaEnum"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string SchemaEnumToJsonValue(SchemaEnum value)
{
if (value == SchemaEnum.ScopeActivity)
return "ScopeActivity";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
/// <summary>
/// Gets or Sets CopyActivitytt
/// </summary>
[JsonPropertyName("copyActivitytt")]
public string CopyActivitytt { 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 CopyActivity {\n");
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
/// <summary>
/// A Json converter for type <see cref="CopyActivity" />
/// </summary>
public class CopyActivityJsonConverter : JsonConverter<CopyActivity>
{
/// <summary>
/// Deserializes json to <see cref="CopyActivity" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override CopyActivity 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<CopyActivity.SchemaEnum?> schema = default;
Option<string> copyActivitytt = 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 "$schema":
string schemaRawValue = utf8JsonReader.GetString();
if (schemaRawValue != null)
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
break;
case "copyActivitytt":
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
if (!copyActivitytt.IsSet)
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
return new CopyActivity(copyActivitytt.Value);
}
/// <summary>
/// Serializes a <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, copyActivity, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="CopyActivity" />
/// </summary>
/// <param name="writer"></param>
/// <param name="copyActivity"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
{
if (copyActivity.CopyActivitytt == null)
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
}
}
}

View File

@ -0,0 +1,184 @@
// <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>
/// EntityBase
/// </summary>
public partial class EntityBase : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EntityBase" /> class.
/// </summary>
[JsonConstructor]
public EntityBase()
{
OnCreated();
}
partial void OnCreated();
/// <summary>
/// The discriminator
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public string Schema { get; } = "EntityBase";
/// <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 EntityBase {\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="EntityBase" />
/// </summary>
public class EntityBaseJsonConverter : JsonConverter<EntityBase>
{
/// <summary>
/// Deserializes json to <see cref="EntityBase" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override EntityBase 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> schema = default;
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
if (discriminator != null && discriminator.Equals("CopyActivity"))
return JsonSerializer.Deserialize<CopyActivity>(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 "$schema":
schema = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (!schema.IsSet)
throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
if (schema.IsSet && schema.Value == null)
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
return new EntityBase();
}
/// <summary>
/// Serializes a <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
if (entityBase is CopyActivity copyActivity){
JsonSerializer.Serialize<CopyActivity>(writer, copyActivity, jsonSerializerOptions);
return;
}
writer.WriteStartObject();
WriteProperties(writer, entityBase, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="EntityBase" />
/// </summary>
/// <param name="writer"></param>
/// <param name="entityBase"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("$schema", entityBase.Schema);
}
}
}

View File

@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs

View File

@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
CopyActivity:
allOf:
- $ref: '#/components/schemas/EntityBase'
properties:
$schema:
enum:
- ScopeActivity
type: string
copyActivitytt:
type: string
required:
- $schema
- copyActivitytt
type: object
EntityBase:
discriminator:
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
propertyName: $schema
properties:
$schema:
type: string
required:
- $schema
type: object
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.CopyActivity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CopyActivitytt** | **string** | |
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EntityBase
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Schema** | **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)

View File

@ -0,0 +1,74 @@
/*
* 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 CopyActivity
/// </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 CopyActivityTests : IDisposable
{
// TODO uncomment below to declare an instance variable for CopyActivity
//private CopyActivity instance;
public CopyActivityTests()
{
// TODO uncomment below to create an instance of CopyActivity
//instance = new CopyActivity();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of CopyActivity
/// </summary>
[Fact]
public void CopyActivityInstanceTest()
{
// TODO uncomment below to test "IsType" CopyActivity
//Assert.IsType<CopyActivity>(instance);
}
/// <summary>
/// Test the property 'CopyActivitytt'
/// </summary>
[Fact]
public void CopyActivityttTest()
{
// TODO unit test for the property 'CopyActivitytt'
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 EntityBase
/// </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 EntityBaseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for EntityBase
//private EntityBase instance;
public EntityBaseTests()
{
// TODO uncomment below to create an instance of EntityBase
//instance = new EntityBase();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of EntityBase
/// </summary>
[Fact]
public void EntityBaseInstanceTest()
{
// TODO uncomment below to test "IsType" EntityBase
//Assert.IsType<EntityBase>(instance);
}
/// <summary>
/// Test deserialize a CopyActivity from type EntityBase
/// </summary>
[Fact]
public void CopyActivityDeserializeFromEntityBaseTest()
{
// TODO uncomment below to test deserialize a CopyActivity from type EntityBase
//Assert.IsType<EntityBase>(JsonConvert.DeserializeObject<EntityBase>(new CopyActivity().ToJson()));
}
/// <summary>
/// Test the property 'Schema'
/// </summary>
[Fact]
public void SchemaTest()
{
// TODO unit test for the property 'Schema'
}
}
}

View File

@ -170,6 +170,8 @@ namespace Org.OpenAPITools.Client
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)

View File

@ -62,11 +62,13 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
_jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());

Some files were not shown because too many files have changed in this diff Show More