[csharp] Replaced property from allOf (#20578)

* replaced inherited property

* removed a comment
This commit is contained in:
devhl-labs 2025-02-09 08:43:50 -05:00 committed by GitHub
parent c74dfa3b3e
commit 01fa58a763
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
243 changed files with 16475 additions and 0 deletions

View File

@ -679,6 +679,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
for (CodegenProperty property : model.nonNullableVars) {
patchProperty(enumRefs, model, property);
}
List<CodegenProperty> overriddenProperties = model.vars.stream().filter(v -> model.allVars.stream().anyMatch(a -> a.baseName.equals(v.baseName) && a.dataType != v.dataType)).collect(Collectors.toList());
for (CodegenProperty overridden : overriddenProperties) {
// if the current model overrides an allOf property, use the overridden property
model.allVars.set(model.allVars.indexOf(model.allVars.stream().filter(a -> a.baseName.equals(overridden.baseName)).findFirst().get()), overridden);
}
}
return processed;
}

View File

@ -2861,3 +2861,30 @@ components:
propertyName: $schema
mapping:
ScopeActivity: '#/components/schemas/CopyActivity'
Result:
type: object
properties:
code:
type: string
description: Result code
uuid:
type: string
description: Result unique identifier
data:
type: object
description: list of named parameters for current message
additionalProperties:
type: string
TestResult:
type: object
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: "#/components/schemas/TestResultCode"
TestResultCode:
type: string
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED

View File

@ -103,6 +103,7 @@ docs/models/RequiredClassRequiredNotnullableEnumString.md
docs/models/RequiredClassRequiredNullableEnumInteger.md
docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md
docs/models/RequiredClassRequiredNullableEnumString.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -121,6 +122,8 @@ docs/models/TestEnumParametersEnumQueryIntegerParameter.md
docs/models/TestEnumParametersRequestEnumFormString.md
docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -261,6 +264,7 @@ src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -279,6 +283,8 @@ src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2617,6 +2617,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -223,6 +223,8 @@ namespace Org.OpenAPITools.Client
return TestEnumParametersRequestEnumFormStringValueConverter.ToJsonValue(testEnumParametersRequestEnumFormString);
if (obj is TestEnumParametersRequestEnumFormStringArrayInner testEnumParametersRequestEnumFormStringArrayInner)
return TestEnumParametersRequestEnumFormStringArrayInnerValueConverter.ToJsonValue(testEnumParametersRequestEnumFormStringArrayInner);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is ZebraType zebraType)
return ZebraTypeValueConverter.ToJsonValue(zebraType);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -154,6 +154,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerOnlyNullableJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringNullableJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -177,6 +178,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerJsonConverter());
_jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerNullableJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,238 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string Code { get { return this.CodeOption; } set { this.CodeOption = new Option<string>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
code = new Option<string>(utf8JsonReader.GetString());
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,238 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new Option<TestResultCode?>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
string codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,175 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -87,6 +87,7 @@ docs/models/Quadrilateral.md
docs/models/QuadrilateralInterface.md
docs/models/ReadOnlyFirst.md
docs/models/RequiredClass.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -100,6 +101,8 @@ docs/models/Tag.md
docs/models/TestCollectionEndingWithWordList.md
docs/models/TestCollectionEndingWithWordListObject.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -222,6 +225,7 @@ src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/RequiredClass.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -235,6 +239,8 @@ src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2795,6 +2795,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -227,6 +227,8 @@ namespace Org.OpenAPITools.Client
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is Zebra.TypeEnum zebraTypeEnum)
return Zebra.TypeEnumToJsonValue(zebraTypeEnum);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -122,6 +122,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter());
_jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -135,6 +136,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,238 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string Code { get { return this.CodeOption; } set { this.CodeOption = new Option<string>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
code = new Option<string>(utf8JsonReader.GetString());
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,238 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new Option<TestResultCode?>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
string codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,175 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -103,6 +103,7 @@ docs/models/RequiredClassRequiredNotnullableEnumString.md
docs/models/RequiredClassRequiredNullableEnumInteger.md
docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md
docs/models/RequiredClassRequiredNullableEnumString.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -121,6 +122,8 @@ docs/models/TestEnumParametersEnumQueryIntegerParameter.md
docs/models/TestEnumParametersRequestEnumFormString.md
docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -261,6 +264,7 @@ src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -279,6 +283,8 @@ src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2617,6 +2617,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -223,6 +223,8 @@ namespace Org.OpenAPITools.Client
return TestEnumParametersRequestEnumFormStringValueConverter.ToJsonValue(testEnumParametersRequestEnumFormString);
if (obj is TestEnumParametersRequestEnumFormStringArrayInner testEnumParametersRequestEnumFormStringArrayInner)
return TestEnumParametersRequestEnumFormStringArrayInnerValueConverter.ToJsonValue(testEnumParametersRequestEnumFormStringArrayInner);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is ZebraType zebraType)
return ZebraTypeValueConverter.ToJsonValue(zebraType);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -154,6 +154,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerOnlyNullableJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringNullableJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -177,6 +178,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerJsonConverter());
_jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerNullableJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,238 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string Code { get { return this.CodeOption; } set { this.CodeOption = new Option<string>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
code = new Option<string>(utf8JsonReader.GetString());
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,238 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new Option<TestResultCode?>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
string codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,175 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -87,6 +87,7 @@ docs/models/Quadrilateral.md
docs/models/QuadrilateralInterface.md
docs/models/ReadOnlyFirst.md
docs/models/RequiredClass.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -100,6 +101,8 @@ docs/models/Tag.md
docs/models/TestCollectionEndingWithWordList.md
docs/models/TestCollectionEndingWithWordListObject.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -222,6 +225,7 @@ src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/RequiredClass.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -235,6 +239,8 @@ src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2795,6 +2795,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -227,6 +227,8 @@ namespace Org.OpenAPITools.Client
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is Zebra.TypeEnum zebraTypeEnum)
return Zebra.TypeEnumToJsonValue(zebraTypeEnum);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -122,6 +122,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter());
_jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -135,6 +136,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,238 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string Code { get { return this.CodeOption; } set { this.CodeOption = new Option<string>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
code = new Option<string>(utf8JsonReader.GetString());
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,238 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new Option<TestResultCode?>(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new Option<Dictionary<string, string>>(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<string>(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
string codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,175 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -103,6 +103,7 @@ docs/models/RequiredClassRequiredNotnullableEnumString.md
docs/models/RequiredClassRequiredNullableEnumInteger.md
docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md
docs/models/RequiredClassRequiredNullableEnumString.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -121,6 +122,8 @@ docs/models/TestEnumParametersEnumQueryIntegerParameter.md
docs/models/TestEnumParametersRequestEnumFormString.md
docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -263,6 +266,7 @@ src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs
src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -281,6 +285,8 @@ src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs
src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2617,6 +2617,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -222,6 +222,8 @@ namespace Org.OpenAPITools.Client
return TestEnumParametersRequestEnumFormStringValueConverter.ToJsonValue(testEnumParametersRequestEnumFormString);
if (obj is TestEnumParametersRequestEnumFormStringArrayInner testEnumParametersRequestEnumFormStringArrayInner)
return TestEnumParametersRequestEnumFormStringArrayInnerValueConverter.ToJsonValue(testEnumParametersRequestEnumFormStringArrayInner);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is ZebraType zebraType)
return ZebraTypeValueConverter.ToJsonValue(zebraType);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -156,6 +156,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerOnlyNullableJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringNullableJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -179,6 +180,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerJsonConverter());
_jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerNullableJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,238 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
code = new Option<string>(utf8JsonReader.GetString());
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,238 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
string codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,175 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -87,6 +87,7 @@ docs/models/Quadrilateral.md
docs/models/QuadrilateralInterface.md
docs/models/ReadOnlyFirst.md
docs/models/RequiredClass.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -100,6 +101,8 @@ docs/models/Tag.md
docs/models/TestCollectionEndingWithWordList.md
docs/models/TestCollectionEndingWithWordListObject.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -224,6 +227,7 @@ src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/RequiredClass.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -237,6 +241,8 @@ src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2795,6 +2795,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -228,6 +228,8 @@ namespace Org.OpenAPITools.Client
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is Zebra.TypeEnum zebraTypeEnum)
return Zebra.TypeEnumToJsonValue(zebraTypeEnum);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -126,6 +126,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter());
_jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -139,6 +140,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,240 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string?> code = default, Option<Dictionary<string, string>?> data = default, Option<string?> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string?> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>?> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string>? Data { get { return this.DataOption; } set { this.DataOption = new(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string?> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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?> code = default;
Option<Dictionary<string, string>?> data = default;
Option<string?> uuid = 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 "code":
code = new Option<string?>(utf8JsonReader.GetString()!);
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>?>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions)!);
break;
case "uuid":
uuid = new Option<string?>(utf8JsonReader.GetString()!);
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,240 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>?> data = default, Option<string?> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>?> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string>? Data { get { return this.DataOption; } set { this.DataOption = new(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string?> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>?> data = default;
Option<string?> uuid = 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 "code":
string? codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>?>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions)!);
break;
case "uuid":
uuid = new Option<string?>(utf8JsonReader.GetString()!);
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code!.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,177 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string? rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string? rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -87,6 +87,7 @@ docs/models/Quadrilateral.md
docs/models/QuadrilateralInterface.md
docs/models/ReadOnlyFirst.md
docs/models/RequiredClass.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -100,6 +101,8 @@ docs/models/Tag.md
docs/models/TestCollectionEndingWithWordList.md
docs/models/TestCollectionEndingWithWordListObject.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -224,6 +227,7 @@ src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/RequiredClass.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -237,6 +241,8 @@ src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2795,6 +2795,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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 TestResult
/// </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 TestResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResult
//private TestResult instance;
public TestResultTests()
{
// TODO uncomment below to create an instance of TestResult
//instance = new TestResult();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResult
/// </summary>
[Fact]
public void TestResultInstanceTest()
{
// TODO uncomment below to test "IsType" TestResult
//Assert.IsType<TestResult>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -226,6 +226,8 @@ namespace Org.OpenAPITools.Client
return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString();
if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum)
return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum);
if (obj is TestResultCode testResultCode)
return TestResultCodeValueConverter.ToJsonValue(testResultCode);
if (obj is Zebra.TypeEnum zebraTypeEnum)
return Zebra.TypeEnumToJsonValue(zebraTypeEnum);
if (obj is ZeroBasedEnum zeroBasedEnum)

View File

@ -124,6 +124,7 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter());
_jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter());
_jsonOptions.Converters.Add(new RequiredClassJsonConverter());
_jsonOptions.Converters.Add(new ResultJsonConverter());
_jsonOptions.Converters.Add(new ReturnJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashJsonConverter());
_jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter());
@ -137,6 +138,9 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter());
_jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter());
_jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter());
_jsonOptions.Converters.Add(new TestResultJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeJsonConverter());
_jsonOptions.Converters.Add(new TestResultCodeNullableJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter());
_jsonOptions.Converters.Add(new UserJsonConverter());

View File

@ -0,0 +1,238 @@
// <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>
/// Result
/// </summary>
public partial class Result : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Result" /> class.
/// </summary>
/// <param name="code">Result code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public Result(Option<string> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> CodeOption { get; private set; }
/// <summary>
/// Result code
/// </summary>
/// <value>Result code</value>
[JsonPropertyName("code")]
public string Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } }
/// <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 Result {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="Result" />
/// </summary>
public class ResultJsonConverter : JsonConverter<Result>
{
/// <summary>
/// Deserializes json to <see cref="Result" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Result 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> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
code = new Option<string>(utf8JsonReader.GetString());
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class Result.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class Result.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class Result.");
return new Result(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, result, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="Result" />
/// </summary>
/// <param name="writer"></param>
/// <param name="result"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions)
{
if (result.CodeOption.IsSet && result.Code == null)
throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result.");
if (result.DataOption.IsSet && result.Data == null)
throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result.");
if (result.UuidOption.IsSet && result.Uuid == null)
throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result.");
if (result.CodeOption.IsSet)
writer.WriteString("code", result.Code);
if (result.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, result.Data, jsonSerializerOptions);
}
if (result.UuidOption.IsSet)
writer.WriteString("uuid", result.Uuid);
}
}
}

View File

@ -0,0 +1,238 @@
// <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>
/// TestResult
/// </summary>
public partial class TestResult : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult" /> class.
/// </summary>
/// <param name="code">code</param>
/// <param name="data">list of named parameters for current message</param>
/// <param name="uuid">Result unique identifier</param>
[JsonConstructor]
public TestResult(Option<TestResultCode?> code = default, Option<Dictionary<string, string>> data = default, Option<string> uuid = default)
{
CodeOption = code;
DataOption = data;
UuidOption = uuid;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Used to track the state of Code
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<TestResultCode?> CodeOption { get; private set; }
/// <summary>
/// Gets or Sets Code
/// </summary>
[JsonPropertyName("code")]
public TestResultCode? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } }
/// <summary>
/// Used to track the state of Data
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<Dictionary<string, string>> DataOption { get; private set; }
/// <summary>
/// list of named parameters for current message
/// </summary>
/// <value>list of named parameters for current message</value>
[JsonPropertyName("data")]
public Dictionary<string, string> Data { get { return this.DataOption; } set { this.DataOption = new(value); } }
/// <summary>
/// Used to track the state of Uuid
/// </summary>
[JsonIgnore]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public Option<string> UuidOption { get; private set; }
/// <summary>
/// Result unique identifier
/// </summary>
/// <value>Result unique identifier</value>
[JsonPropertyName("uuid")]
public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } }
/// <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 TestResult {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Data: ").Append(Data).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="TestResult" />
/// </summary>
public class TestResultJsonConverter : JsonConverter<TestResult>
{
/// <summary>
/// Deserializes json to <see cref="TestResult" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override TestResult 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<TestResultCode?> code = default;
Option<Dictionary<string, string>> data = default;
Option<string> uuid = 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 "code":
string codeRawValue = utf8JsonReader.GetString();
if (codeRawValue != null)
code = new Option<TestResultCode?>(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue));
break;
case "data":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
data = new Option<Dictionary<string, string>>(JsonSerializer.Deserialize<Dictionary<string, string>>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "uuid":
uuid = new Option<string>(utf8JsonReader.GetString());
break;
default:
break;
}
}
}
if (code.IsSet && code.Value == null)
throw new ArgumentNullException(nameof(code), "Property is not nullable for class TestResult.");
if (data.IsSet && data.Value == null)
throw new ArgumentNullException(nameof(data), "Property is not nullable for class TestResult.");
if (uuid.IsSet && uuid.Value == null)
throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class TestResult.");
return new TestResult(code, data, uuid);
}
/// <summary>
/// Serializes a <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, testResult, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="TestResult" />
/// </summary>
/// <param name="writer"></param>
/// <param name="testResult"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions)
{
if (testResult.DataOption.IsSet && testResult.Data == null)
throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult.");
if (testResult.UuidOption.IsSet && testResult.Uuid == null)
throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult.");
if (testResult.CodeOption.IsSet)
{
var codeRawValue = TestResultCodeValueConverter.ToJsonValue(testResult.Code.Value);
writer.WriteString("code", codeRawValue);
}
if (testResult.DataOption.IsSet)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, testResult.Data, jsonSerializerOptions);
}
if (testResult.UuidOption.IsSet)
writer.WriteString("uuid", testResult.Uuid);
}
}
}

View File

@ -0,0 +1,175 @@
// <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>
/// Result code
/// </summary>
/// <value>Result code</value>
public enum TestResultCode
{
/// <summary>
/// Enum APPROVED for value: APPROVED
/// </summary>
APPROVED = 1,
/// <summary>
/// Enum MANUALAPPROVALREQUIRED for value: MANUAL_APPROVAL_REQUIRED
/// </summary>
MANUALAPPROVALREQUIRED = 2
}
/// <summary>
/// Converts <see cref="TestResultCode"/> to and from the JSON value
/// </summary>
public static class TestResultCodeValueConverter
{
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode FromString(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
throw new NotImplementedException($"Could not convert value to type TestResultCode: '{value}'");
}
/// <summary>
/// Parses a given value to <see cref="TestResultCode"/>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static TestResultCode? FromStringOrDefault(string value)
{
if (value.Equals("APPROVED"))
return TestResultCode.APPROVED;
if (value.Equals("MANUAL_APPROVAL_REQUIRED"))
return TestResultCode.MANUALAPPROVALREQUIRED;
return null;
}
/// <summary>
/// Converts the <see cref="TestResultCode"/> to the json value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string ToJsonValue(TestResultCode value)
{
if (value == TestResultCode.APPROVED)
return "APPROVED";
if (value == TestResultCode.MANUALAPPROVALREQUIRED)
return "MANUAL_APPROVAL_REQUIRED";
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
public class TestResultCodeJsonConverter : JsonConverter<TestResultCode>
{
/// <summary>
/// Returns a from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the TestResultCode to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode.ToString());
}
}
/// <summary>
/// A Json converter for type <see cref="TestResultCode"/>
/// </summary>
public class TestResultCodeNullableJsonConverter : JsonConverter<TestResultCode?>
{
/// <summary>
/// Returns a TestResultCode from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override TestResultCode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string rawValue = reader.GetString();
TestResultCode? result = rawValue == null
? null
: TestResultCodeValueConverter.FromStringOrDefault(rawValue);
if (result != null)
return result.Value;
throw new JsonException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="testResultCode"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, TestResultCode? testResultCode, JsonSerializerOptions options)
{
writer.WriteStringValue(testResultCode?.ToString() ?? "null");
}
}
}

View File

@ -87,6 +87,7 @@ docs/models/Quadrilateral.md
docs/models/QuadrilateralInterface.md
docs/models/ReadOnlyFirst.md
docs/models/RequiredClass.md
docs/models/Result.md
docs/models/Return.md
docs/models/RolesReportsHash.md
docs/models/RolesReportsHashRole.md
@ -100,6 +101,8 @@ docs/models/Tag.md
docs/models/TestCollectionEndingWithWordList.md
docs/models/TestCollectionEndingWithWordListObject.md
docs/models/TestInlineFreeformAdditionalPropertiesRequest.md
docs/models/TestResult.md
docs/models/TestResultCode.md
docs/models/Triangle.md
docs/models/TriangleInterface.md
docs/models/User.md
@ -224,6 +227,7 @@ src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/RequiredClass.cs
src/Org.OpenAPITools/Model/Result.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/RolesReportsHash.cs
src/Org.OpenAPITools/Model/RolesReportsHashRole.cs
@ -237,6 +241,8 @@ src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs
src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs
src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs
src/Org.OpenAPITools/Model/TestResult.cs
src/Org.OpenAPITools/Model/TestResultCode.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs

View File

@ -2795,6 +2795,33 @@ components:
required:
- $schema
type: object
Result:
properties:
code:
description: Result code
type: string
uuid:
description: Result unique identifier
type: string
data:
additionalProperties:
type: string
description: list of named parameters for current message
type: object
type: object
TestResult:
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: '#/components/schemas/TestResultCode'
type: object
TestResultCode:
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
type: string
_foo_get_default_response:
example:
string:

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Result
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Result code | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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,12 @@
# Org.OpenAPITools.Model.TestResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **TestResultCode** | | [optional]
**Data** | **Dictionary&lt;string, string&gt;** | list of named parameters for current message | [optional]
**Uuid** | **string** | Result unique identifier | [optional]
[[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.TestResultCode
Result code
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,83 @@
/*
* 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 Result
/// </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 ResultTests : IDisposable
{
// TODO uncomment below to declare an instance variable for Result
//private Result instance;
public ResultTests()
{
// TODO uncomment below to create an instance of Result
//instance = new Result();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of Result
/// </summary>
[Fact]
public void ResultInstanceTest()
{
// TODO uncomment below to test "IsType" Result
//Assert.IsType<Result>(instance);
}
/// <summary>
/// Test the property 'Code'
/// </summary>
[Fact]
public void CodeTest()
{
// TODO unit test for the property 'Code'
}
/// <summary>
/// Test the property 'Data'
/// </summary>
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Fact]
public void UuidTest()
{
// TODO unit test for the property 'Uuid'
}
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestResultCode
/// </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 TestResultCodeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestResultCode
//private TestResultCode instance;
public TestResultCodeTests()
{
// TODO uncomment below to create an instance of TestResultCode
//instance = new TestResultCode();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of TestResultCode
/// </summary>
[Fact]
public void TestResultCodeInstanceTest()
{
// TODO uncomment below to test "IsType" TestResultCode
//Assert.IsType<TestResultCode>(instance);
}
}
}

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