[csharp-netcore] Upgrade to System.Text.Json (#11741)

* refactor nrt annotation

* enable nrt by default in .net6.0+

* use shorter nrt annotation

* build samples

* removed debugging lines

* fixed model and operatoin constructors

* reverted a commented line for comparison

* upgraded to System.Text.Json

* build samples

* build samples

* deleted samples to remove old files

* bug fixes

* bug fixes

* added tasks to track the bugs
This commit is contained in:
devhl-labs 2022-03-10 02:02:42 -05:00 committed by GitHub
parent fb2c41c720
commit 22a1906480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
423 changed files with 9121 additions and 14523 deletions

View File

@ -403,7 +403,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
return super.addMustacheLambdas()
.put("camelcase_param", new CamelCaseLambda().generator(this).escapeAsParamName(true))
.put("required", new RequiredParameterLambda().generator(this))
.put("optional", new OptionalParameterLambda().generator(this));
.put("optional", new OptionalParameterLambda().generator(this))
.put("joinWithComma", new JoinWithCommaLambda());
}
@Override

View File

@ -42,6 +42,7 @@ import java.util.List;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
import static org.openapitools.codegen.CodegenDiscriminator.MappedModel;
@SuppressWarnings("Duplicates")
public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
@ -516,6 +517,14 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
postProcessPattern(property.pattern, property.vendorExtensions);
postProcessEmitDefaultValue(property.vendorExtensions);
if (GENERICHOST.equals(getLibrary())) {
// all c# libraries should want this, but avoid breaking changes for now
// a class cannot contain a property with the same name
if (property.name.equals(model.classname)) {
property.name = property.name + "Property";
}
}
super.postProcessModelProperty(model, property);
}
@ -892,8 +901,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj"));
supportingFiles.add(new SupportingFile("appveyor.mustache", "", "appveyor.yml"));
supportingFiles.add(new SupportingFile("AbstractOpenAPISchema.mustache", modelPackageDir, "AbstractOpenAPISchema.cs"));
supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateConverter.cs"));
supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateJsonConverter.cs"));
supportingFiles.add(new SupportingFile("ApiResponseEventArgs.mustache", clientPackageDir, "ApiResponseEventArgs.cs"));
supportingFiles.add(new SupportingFile("IApi.mustache", clientPackageDir, getInterfacePrefix() + "Api.cs"));
@ -1327,11 +1335,129 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
cm.isNullable = true;
cm.anyOf.remove("Null");
}
for (CodegenProperty cp : cm.readWriteVars) {
// ISSUE: https://github.com/OpenAPITools/openapi-generator/issues/11844
// allVars may not have all properties
// see modules\openapi-generator\src\test\resources\3_0\allOf.yaml
// property boosterSeat will be in readWriteVars but not allVars
// the property is present in the model but gets removed at CodegenModel#removeDuplicatedProperty
if (Boolean.FALSE.equals(cm.allVars.stream().anyMatch(v -> v.baseName.equals(cp.baseName)))) {
LOGGER.debug("Property " + cp.baseName + " was found in readWriteVars but not in allVars. Adding it back to allVars");
cm.allVars.add(cp);
}
}
for (CodegenProperty cp : cm.allVars) {
// ISSUE: https://github.com/OpenAPITools/openapi-generator/issues/11845
// some properties do not have isInherited set correctly
// see modules\openapi-generator\src\test\resources\3_0\allOf.yaml
// Child properties Type, LastName, FirstName will have isInherited set to false when it should be true
if (cp.isInherited){
continue;
}
if (Boolean.TRUE.equals(cm.parentVars.stream().anyMatch(v -> v.baseName.equals(cp.baseName) && v.dataType.equals(cp.dataType)))) {
LOGGER.debug("Property " + cp.baseName + " was found in the parentVars but not marked as inherited.");
cp.isInherited = true;
}
}
}
return objs;
}
/**
* ISSUE: https://github.com/OpenAPITools/openapi-generator/issues/11846
* Ensures that a model has all inherited properties
* Check modules\openapi-generator\src\test\resources\3_0\java\petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
* Without this method, property petType in GrandparentAnimal will not make it through ParentPet and into ChildCat
*/
private void EnsureInheritedVariablesArePresent(CodegenModel derivedModel) {
// every c# generator should definetly want this, or we should fix the issue
// still, lets avoid breaking changes :(
if (Boolean.FALSE.equals(GENERICHOST.equals(getLibrary()))){
return;
}
if (derivedModel.parentModel == null){
return;
}
for (CodegenProperty parentProperty : derivedModel.parentModel.allVars){
if (Boolean.FALSE.equals(derivedModel.allVars.stream().anyMatch(v -> v.baseName.equals(parentProperty.baseName)))) {
CodegenProperty clone = parentProperty.clone();
clone.isInherited = true;
LOGGER.debug("Inherited property " + clone.name + " from model" + derivedModel.parentModel.classname + " was not found in " + derivedModel.classname + ". Adding a clone now.");
derivedModel.allVars.add(clone);
}
}
EnsureInheritedVariablesArePresent(derivedModel.parentModel);
}
/**
* Invoked by {@link DefaultGenerator} after all models have been post-processed, allowing for a last pass of codegen-specific model cleanup.
*
* @param objs Current state of codegen object model.
* @return An in-place modified state of the codegen object model.
*/
@Override
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
objs = super.postProcessAllModels(objs);
// other libraries probably want these fixes, but lets avoid breaking changes for now
if (Boolean.FALSE.equals(GENERICHOST.equals(getLibrary()))){
return objs;
}
ArrayList<CodegenModel> allModels = new ArrayList<CodegenModel>();
for (Map.Entry<String, Object> entry : objs.entrySet()) {
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), objs);
allModels.add(model);
}
for (CodegenModel cm : allModels) {
if (cm.parent != null){
// remove the parent CodegenProperty from the model
// we need it gone so we can use allOf/oneOf/anyOf in the constructor
cm.allOf.removeIf(item -> item.equals(cm.parent));
cm.oneOf.removeIf(item -> item.equals(cm.parent));
cm.anyOf.removeIf(item -> item.equals(cm.parent));
}
cm.anyOf.forEach(anyOf -> removePropertiesDeclaredInComposedClass(anyOf, allModels, cm));
cm.oneOf.forEach(oneOf -> removePropertiesDeclaredInComposedClass(oneOf, allModels, cm));
cm.allOf.forEach(allOf -> removePropertiesDeclaredInComposedClass(allOf, allModels, cm));
EnsureInheritedVariablesArePresent(cm);
}
return objs;
}
/**
* Removes properties from a model which are also defined in a composed class.
*
* @param className The name which may be a composed model
* @param allModels A collection of all CodegenModel
* @param cm The CodegenModel to correct
*/
private void removePropertiesDeclaredInComposedClass(String className, List<CodegenModel> allModels, CodegenModel cm) {
CodegenModel otherModel = allModels.stream().filter(m -> m.classname.equals(className)).findFirst().orElse(null);
if (otherModel == null){
return;
}
otherModel.readWriteVars.stream().filter(v -> cm.readWriteVars.stream().anyMatch(cmV -> cmV.baseName.equals(v.baseName))).collect(Collectors.toList())
.forEach(v -> {
cm.readWriteVars.removeIf(item -> item.baseName.equals(v.baseName));
cm.vars.removeIf(item -> item.baseName.equals(v.baseName));
cm.readOnlyVars.removeIf(item -> item.baseName.equals(v.baseName));
cm.requiredVars.removeIf(item -> item.baseName.equals(v.baseName));
cm.allVars.removeIf(item -> item.baseName.equals(v.baseName));
});
}
@Override
public void postProcess() {
System.out.println("################################################################################");

View File

@ -8,7 +8,9 @@
{{#enumVars}}
{{#-first}}
{{#isString}}
{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/useGenericHost}}
{{/isString}}
{{/-first}}
{{/enumVars}}

View File

@ -6,7 +6,9 @@
/// <value>{{description}}</value>
{{/description}}
{{#isString}}
{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/useGenericHost}}
{{/isString}}
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{

View File

@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
namespace {{packageName}}.Client
{

View File

@ -46,21 +46,53 @@ namespace {{packageName}}.Client
public delegate void EventHandler<T>(object sender, T e) where T : EventArgs;
/// <summary>
/// Custom JSON serializer
/// Returns true when deserialization succeeds.
/// </summary>
public static Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get; set; } = new Newtonsoft.Json.JsonSerializerSettings
/// <typeparam name="T"></typeparam>
/// <param name="json"></param>
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(string json, System.Text.Json.JsonSerializerOptions options, {{^netStandard}}[System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/netStandard}}out T{{#nrt}}{{^netStandard}}?{{/netStandard}}{{/nrt}} result)
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = Newtonsoft.Json.ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore,
ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver
try
{
NamingStrategy = new Newtonsoft.Json.Serialization.CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
result = System.Text.Json.JsonSerializer.Deserialize<T>(json, options);
return result != null;
}
};
catch (Exception)
{
result = default;
return false;
}
}
/// <summary>
/// Returns true when deserialization succeeds.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reader"></param>
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, {{^netStandard}}[System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/netStandard}}out T{{#nrt}}{{^netStandard}}?{{/netStandard}}{{/nrt}} result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(ref reader, options);
return result != null;
}
catch (Exception)
{
result = default;
return false;
}
}
/// <summary>
/// Json serializer options
/// </summary>
public static System.Text.Json.JsonSerializerOptions JsonSerializerOptions { get; set; } = new System.Text.Json.JsonSerializerOptions();
/// <summary>
/// Sanitize filename by removing the path
@ -169,7 +201,7 @@ namespace {{packageName}}.Client
/// </summary>
/// <param name="contentTypes">The Content-Type array to select from.</param>
/// <returns>The Content-Type header to use.</returns>
public static string SelectHeaderContentType(string[] contentTypes)
public static string{{nrt?}} SelectHeaderContentType(string[] contentTypes)
{
if (contentTypes.Length == 0)
return null;
@ -190,7 +222,7 @@ namespace {{packageName}}.Client
/// </summary>
/// <param name="accepts">The accepts array to select from.</param>
/// <returns>The Accept header to use.</returns>
public static string SelectHeaderAccept(string[] accepts)
public static string{{nrt?}} SelectHeaderAccept(string[] accepts)
{
if (accepts.Length == 0)
return null;

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using {{packageName}}.Api;
using {{packageName}}.Model;
namespace {{packageName}}.Client
{
@ -63,6 +64,31 @@ namespace {{packageName}}.Client
public HostConfiguration Add{{apiName}}HttpClients(
Action<HttpClient>{{nrt?}} client = null, Action<IHttpClientBuilder>{{nrt?}} builder = null)
{
ClientUtils.JsonSerializerOptions.Converters.Add(new OpenAPIDateJsonConverter());
{{#models}}
{{#model}}
{{^isEnum}}
{{#useGenericHost}}
{{#allOf}}
{{#-first}}
ClientUtils.JsonSerializerOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/allOf}}
{{#anyOf}}
{{#-first}}
ClientUtils.JsonSerializerOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/anyOf}}
{{#oneOf}}
{{#-first}}
ClientUtils.JsonSerializerOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/oneOf}}
{{/useGenericHost}}
{{/isEnum}}
{{/model}}
{{/models}}
Add{{apiName}}HttpClients<{{#apiInfo}}{{#apis}}{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>(client, builder);
return this;
@ -73,9 +99,9 @@ namespace {{packageName}}.Client
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public HostConfiguration ConfigureJsonOptions(Action<Newtonsoft.Json.JsonSerializerSettings> options)
public HostConfiguration ConfigureJsonOptions(Action<System.Text.Json.JsonSerializerOptions> options)
{
options(Client.ClientUtils.JsonSerializerSettings);
options(Client.ClientUtils.JsonSerializerOptions);
return this;
}

View File

@ -0,0 +1,128 @@
/// <summary>
/// A Json converter for type {{classname}}
/// </summary>
public class {{classname}}JsonConverter : JsonConverter<{{classname}}>
{
/// <summary>
/// Returns a boolean if the type is compatible with this converter.
/// </summary>
/// <param name="typeToConvert"></param>
/// <returns></returns>
public override bool CanConvert(Type typeToConvert) => typeof({{classname}}).IsAssignableFrom(typeToConvert);
/// <summary>
/// A Json reader.
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override {{classname}} Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
int currentDepth = reader.CurrentDepth;
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
{{#anyOf}}
Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
{{/anyOf}}
{{#oneOf}}
Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
{{/oneOf}}
{{#allOf}}
Utf8JsonReader {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader = reader;
Client.ClientUtils.TryDeserialize<{{.}}>(ref {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}Reader, options, out {{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}});
{{/allOf}}
{{#allVars}}
{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default;
{{/allVars}}
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
break;
if (reader.TokenType == JsonTokenType.PropertyName)
{
string{{nrt?}} propertyName = reader.GetString();
reader.Read();
switch (propertyName)
{
{{#allVars}}
case "{{baseName}}":
{{#isString}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetString();
{{/isString}}
{{#isBoolean}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetBoolean();
{{/isBoolean}}
{{#isDecimal}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetDecimal();
{{/isDecimal}}
{{#isNumeric}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetInt32();
{{/isNumeric}}
{{#isLong}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetInt64();
{{/isLong}}
{{#isDouble}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetDouble();
{{/isDouble}}
{{#isDate}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetDateTime();
{{/isDate}}
{{#isDateTime}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = reader.GetDateTime();
{{/isDateTime}}
{{^isString}}
{{^isBoolean}}
{{^isDecimal}}
{{^isNumeric}}
{{^isLong}}
{{^isDouble}}
{{^isDate}}
{{^isDateTime}}
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref reader, options);
{{/isDateTime}}
{{/isDate}}
{{/isDouble}}
{{/isLong}}
{{/isNumeric}}
{{/isDecimal}}
{{/isBoolean}}
{{/isString}}
break;
{{/allVars}}
}
}
}
{{#oneOf}}
if ({{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} != null)
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{#allOf}}{{#lambda.camelcase_param}}{{.}} {{/lambda.camelcase_param}}{{/allOf}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
{{#-last}}
throw new JsonException();
{{/-last}}
{{/oneOf}}
{{^oneOf}}
return new {{classname}}({{#lambda.joinWithComma}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}});
{{/oneOf}}
}
/// <summary>
/// A Json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="{{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}"></param>
/// <param name="options"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, {{classname}} {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}, JsonSerializerOptions options) => throw new NotImplementedException();
}

View File

@ -0,0 +1,34 @@
{{>partial_header}}
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace {{packageName}}.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class OpenAPIDateJsonConverter : JsonConverter<DateTime>
{
/// <summary>
/// Returns a DateTime from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
DateTime.ParseExact(reader.GetString(){{nrt!}}, "yyyy-MM-dd", CultureInfo.InvariantCulture);
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateTimeValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateTimeValue.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
}
}

View File

@ -279,7 +279,8 @@ namespace {{packageName}}.{{apiPackage}}
if (({{paramName}} as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject({{paramName}}, ClientUtils.JsonSerializerSettings));{{/bodyParam}}{{#authMethods}}{{#-first}}
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject({{paramName}}, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize({{paramName}}, ClientUtils.JsonSerializerOptions));{{/bodyParam}}{{#authMethods}}{{#-first}}
List<TokenBase> tokens = new List<TokenBase>();{{/-first}}{{#isApiKey}}
@ -347,7 +348,7 @@ namespace {{packageName}}.{{apiPackage}}
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
{{/-first}}{{/produces}}{{^netStandard}}
request.Method = HttpMethod.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}};{{/netStandard}}{{#netStandard}}
request.Method = new HttpMethod("{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}");{{/netStandard}} {{! early standard versions do not have HttpMethod.Patch }}
request.Method = new HttpMethod("{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}");{{/netStandard}}{{! early standard versions do not have HttpMethod.Patch }}
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -370,7 +371,7 @@ namespace {{packageName}}.{{apiPackage}}
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}{{nrt?}}> apiResponse = new ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}{{nrt?}}>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);{{#authMethods}}
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);{{#authMethods}}
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();{{/authMethods}}

View File

@ -0,0 +1,47 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using System.Text.Json;
using System.Text.Json.Serialization;
{{#validatable}}
using System.ComponentModel.DataAnnotations;
{{/validatable}}
{{#useCompareNetObjects}}
using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils;
{{/useCompareNetObjects}}
{{#models}}
{{#model}}
namespace {{packageName}}.{{modelPackage}}
{
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}
{{#allOf}}
{{#-first}}
{{>JsonConverter}}
{{/-first}}
{{/allOf}}
{{#anyOf}}
{{#-first}}
{{>JsonConverter}}
{{/-first}}
{{/anyOf}}
{{#oneOf}}
{{#-first}}
{{>JsonConverter}}
{{/-first}}
{{/oneOf}}
{{/isEnum}}
{{/model}}
{{/models}}
}

View File

@ -1,15 +1,88 @@
/// <summary>
/// {{description}}{{^description}}{{classname}}{{/description}}
/// </summary>
[DataContract(Name = "{{{name}}}")]
{{#discriminator}}
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
{{#mappedModels}}
[JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
{{/mappedModels}}
{{/discriminator}}
{{>visibility}} partial class {{classname}} : {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}}
{{>visibility}} partial class {{classname}} : {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}{{^parentModel}}, IValidatableObject{{/parentModel}}{{/validatable}}
{
{{#oneOf}}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
/// </summary>
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
{{#anyOf}}
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
{{/anyOf}}
{{#allOf}}
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
{{/allOf}}
{{#allVars}}
/// <param name="{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}">{{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
{{/allVars}}
public {{classname}}({{#lambda.joinWithComma}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{#anyOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^required}}{{^defaultValue}} = default{{/defaultValue}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#isInherited}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/isInherited}}{{#anyOf}}{{#isInherited}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/isInherited}}{{/anyOf}}{{#allVars}}{{#isInherited}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/isInherited}}{{/allVars}}{{/lambda.joinWithComma}}){{/parent}}
{
{{#allVars}}
{{^isInherited}}
{{#required}}
{{^isNullable}}
if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} == null)
throw new ArgumentNullException("{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} is a required property for {{classname}} and cannot be null.");
{{/isNullable}}
{{/required}}
{{/isInherited}}
{{/allVars}}
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
{{#anyOf}}
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
{{/anyOf}}
{{#allOf}}
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
{{/allOf}}
{{#allVars}}
{{^isInherited}}
{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/isInherited}}
{{/allVars}}
}
{{/oneOf}}
{{^oneOf}}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
/// </summary>
{{#anyOf}}
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
{{/anyOf}}
{{#allOf}}
/// <param name="{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}">{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}}</param>
{{/allOf}}
{{#allVars}}
/// <param name="{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}">{{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
{{/allVars}}
public {{classname}}({{#lambda.joinWithComma}}{{#anyOf}}{{.}}{{nrt?}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allOf}}{{.}} {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/allOf}}{{#allVars}}{{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^required}}{{^defaultValue}} = default{{/defaultValue}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}){{#parentModel}} : base({{#lambda.joinWithComma}}{{#anyOf}}{{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}} {{/anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{/allVars}}{{/lambda.joinWithComma}}){{/parentModel}}
{
{{#allVars}}
{{^isInherited}}
{{#required}}
{{^isNullable}}
if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} == null)
throw new ArgumentNullException("{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} is a required property for {{classname}} and cannot be null.");
{{/isNullable}}
{{/required}}
{{/isInherited}}
{{/allVars}}
{{#anyOf}}
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
{{/anyOf}}
{{#allOf}}
{{.}} = {{#lambda.camelcase_param}}{{.}}{{/lambda.camelcase_param}};
{{/allOf}}
{{#allVars}}
{{^isInherited}}
{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/isInherited}}
{{/allVars}}
}
{{/oneOf}}
{{#vars}}
{{#items.isEnum}}
{{#items}}
@ -24,257 +97,78 @@
{{/complexType}}
{{/isEnum}}
{{#isEnum}}
/// <summary>
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>
{{#description}}
/// <value>{{.}}</value>
{{/description}}
{{^conditionalSerialization}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/vendorExtensions.x-emit-default-value}})]
[JsonPropertyName("{{baseName}}")]
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{name}} { get; set; }
{{#isReadOnly}}
/// <summary>
/// Returns false as {{name}} should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerialize{{name}}()
{
return false;
}
{{/isReadOnly}}
{{/conditionalSerialization}}
{{#conditionalSerialization}}
{{#isReadOnly}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/vendorExtensions.x-emit-default-value}})]
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{name}} { get; set; }
/// <summary>
/// Returns false as {{name}} should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerialize{{name}}()
{
return false;
}
{{/isReadOnly}}
{{^isReadOnly}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/vendorExtensions.x-emit-default-value}})]
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{{complexType}}}{{^complexType}}{{{datatypeWithEnum}}}{{/complexType}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}} {{name}}
{
get{ return _{{name}};}
set
{
_{{name}} = value;
_flag{{name}} = true;
}
}
private {{{complexType}}}{{^complexType}}{{{datatypeWithEnum}}}{{/complexType}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}} _{{name}};
private bool _flag{{name}};
/// <summary>
/// Returns false as {{name}} should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerialize{{name}}()
{
return _flag{{name}};
}
{{/isReadOnly}}
{{/conditionalSerialization}}
public {{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
{{/isEnum}}
{{/vars}}
{{#hasRequired}}
{{^hasOnlyReadOnly}}
{{#anyOf}}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
/// </summary>
[JsonConstructorAttribute]
{{^isAdditionalPropertiesTrue}}
protected {{classname}}() { }
{{/isAdditionalPropertiesTrue}}
{{#isAdditionalPropertiesTrue}}
protected {{classname}}()
{
this.AdditionalProperties = new Dictionary<string, object>();
}
{{/isAdditionalPropertiesTrue}}
{{/hasOnlyReadOnly}}
{{/hasRequired}}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
/// </summary>
{{#readWriteVars}}
/// <param name="{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}">{{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}.</param>
{{/readWriteVars}}
{{#hasOnlyReadOnly}}
[JsonConstructorAttribute]
{{/hasOnlyReadOnly}}
public {{classname}}({{#readWriteVars}}{{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^required}}{{^defaultValue}} = default{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/readWriteVars}}){{#parent}} : base({{#parentVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{^-last}}, {{/-last}}{{/parentVars}}){{/parent}}
{
{{#vars}}
{{^isInherited}}
{{^isReadOnly}}
{{#required}}
{{^conditionalSerialization}}
{{^vendorExtensions.x-csharp-value-type}}
// to ensure "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" is required (not null)
if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} == null) {
throw new ArgumentNullException("{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} is a required property for {{classname}} and cannot be null");
}
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/vendorExtensions.x-csharp-value-type}}
{{/conditionalSerialization}}
{{#conditionalSerialization}}
{{^vendorExtensions.x-csharp-value-type}}
// to ensure "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" is required (not null)
if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} == null) {
throw new ArgumentNullException("{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} is a required property for {{classname}} and cannot be null");
}
this._{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
this._{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/vendorExtensions.x-csharp-value-type}}
{{/conditionalSerialization}}
{{/required}}
{{/isReadOnly}}
{{/isInherited}}
{{/vars}}
{{#vars}}
{{^isInherited}}
{{^isReadOnly}}
{{^required}}
{{#defaultValue}}
{{^conditionalSerialization}}
{{^vendorExtensions.x-csharp-value-type}}
// use default value if no "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" provided
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} ?? {{{defaultValue}}};
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/vendorExtensions.x-csharp-value-type}}
{{/conditionalSerialization}}
{{/defaultValue}}
{{^defaultValue}}
{{^conditionalSerialization}}
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/conditionalSerialization}}
{{#conditionalSerialization}}
this._{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/conditionalSerialization}}
{{/defaultValue}}
{{/required}}
{{/isReadOnly}}
{{/isInherited}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
this.AdditionalProperties = new Dictionary<string, object>();
{{/isAdditionalPropertiesTrue}}
}
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
{{#vars}}
{{/anyOf}}
{{#oneOf}}
/// <summary>
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
{{/oneOf}}
{{#allOf}}
/// <summary>
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{.}}{{nrt?}} {{.}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
{{/allOf}}
{{#allVars}}
{{^isInherited}}
{{^isEnum}}
/// <summary>
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{^conditionalSerialization}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/vendorExtensions.x-emit-default-value}})]
{{#isDate}}
[JsonConverter(typeof(OpenAPIDateConverter))]
{{/isDate}}
[JsonPropertyName("{{baseName}}")]
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{#isNullable}}{{#required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}}{{^isNullable}}{{#required}}{{{datatypeWithEnum}}}{{/required}}{{/isNullable}}{{#isNullable}}{{^required}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/required}}{{/isNullable}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
{{#isReadOnly}}
/// <summary>
/// Returns false as {{name}} should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerialize{{name}}()
{
return false;
}
{{/isReadOnly}}
{{/conditionalSerialization}}
{{#conditionalSerialization}}
{{#isReadOnly}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/vendorExtensions.x-emit-default-value}})]
{{#isDate}}
[JsonConverter(typeof(OpenAPIDateConverter))]
{{/isDate}}
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{#isNullable}}{{#lambda.optional}}{{{dataType}}}{{/lambda.optional}}{{/isNullable}}{{^isNullable}}{{{dataType}}}{{/isNullable}} {{name}} { get; private set; }
/// <summary>
/// Returns false as {{name}} should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerialize{{name}}()
{
return false;
}
{{/isReadOnly}}
{{^isReadOnly}}
{{#isDate}}
[JsonConverter(typeof(OpenAPIDateConverter))]
{{/isDate}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/vendorExtensions.x-emit-default-value}})]
{{#deprecated}}
[Obsolete]
{{/deprecated}}
public {{#required}}{{#lambda.required}}{{{dataType}}}{{/lambda.required}}{{/required}}{{^required}}{{#lambda.optional}}{{{dataType}}}{{/lambda.optional}}{{/required}} {{name}}
{
get{ return _{{name}};}
set
{
_{{name}} = value;
_flag{{name}} = true;
}
}
private {{{dataType}}} _{{name}};
private bool _flag{{name}};
/// <summary>
/// Returns false as {{name}} should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerialize{{name}}()
{
return _flag{{name}};
}
{{/isReadOnly}}
{{/conditionalSerialization}}
{{/isEnum}}
{{/isInherited}}
{{/vars}}
{{/allVars}}
{{#isAdditionalPropertiesTrue}}
{{^parentModel}}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
{{/parentModel}}
{{/isAdditionalPropertiesTrue}}
/// <summary>
/// Returns the string presentation of the object
@ -291,27 +185,20 @@
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
{{/vars}}
{{#isAdditionalPropertiesTrue}}
{{^parentModel}}
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
{{/parentModel}}
{{/isAdditionalPropertiesTrue}}
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public {{#parent}}{{^isArray}}{{^isMap}}override {{/isMap}}{{/isArray}}{{/parent}}{{^parent}}virtual {{/parent}}string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object{{nrt?}} input)
{
{{#useCompareNetObjects}}
return OpenAPIClientUtils.compareLogic.Compare(this, input as {{classname}}).AreEqual;
@ -326,7 +213,7 @@
/// </summary>
/// <param name="input">Instance of {{classname}} to be compared</param>
/// <returns>Boolean</returns>
public bool Equals({{classname}} input)
public bool Equals({{classname}}{{nrt?}} input)
{
{{#useCompareNetObjects}}
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
@ -354,7 +241,9 @@
{{/vendorExtensions.x-is-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
{{#isAdditionalPropertiesTrue}}
{{^parentModel}}
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
{{/parentModel}}
{{/isAdditionalPropertiesTrue}}
{{/useCompareNetObjects}}
}
@ -385,104 +274,20 @@
{{/vendorExtensions.x-is-value-type}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
{{^parentModel}}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
}
{{/parentModel}}
{{/isAdditionalPropertiesTrue}}
return hashCode;
}
}
{{#validatable}}
{{#discriminator}}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
{{/discriminator}}
{{^discriminator}}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
{{/discriminator}}
{{#parent}}
{{^isArray}}
{{^isMap}}
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
{{/isMap}}
{{/isArray}}
{{/parent}}
{{#vars}}
{{#hasValidation}}
{{^isEnum}}
{{#maxLength}}
// {{{name}}} ({{{dataType}}}) maxLength
if (this.{{{name}}} != null && this.{{{name}}}.Length > {{maxLength}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be less than {{maxLength}}.", new [] { "{{{name}}}" });
}
{{/maxLength}}
{{#minLength}}
// {{{name}}} ({{{dataType}}}) minLength
if (this.{{{name}}} != null && this.{{{name}}}.Length < {{minLength}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be greater than {{minLength}}.", new [] { "{{{name}}}" });
}
{{/minLength}}
{{#maximum}}
// {{{name}}} ({{{dataType}}}) maximum
if (this.{{{name}}} > ({{{dataType}}}){{maximum}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" });
}
{{/maximum}}
{{#minimum}}
// {{{name}}} ({{{dataType}}}) minimum
if (this.{{{name}}} < ({{{dataType}}}){{minimum}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" });
}
{{/minimum}}
{{#pattern}}
{{^isByteArray}}
// {{{name}}} ({{{dataType}}}) pattern
Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}});
if (false == regex{{{name}}}.Match(this.{{{name}}}).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" });
}
{{/isByteArray}}
{{/pattern}}
{{/isEnum}}
{{/hasValidation}}
{{/vars}}
yield break;
}
{{^parentModel}}
{{>validatable}}
{{/parentModel}}
{{/validatable}}
}
}

View File

@ -8,7 +8,9 @@
{{#enumVars}}
{{#-first}}
{{#isString}}
{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/useGenericHost}}
{{/isString}}
{{/-first}}
{{/enumVars}}

View File

@ -403,94 +403,6 @@
}
{{#validatable}}
{{#discriminator}}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
{{/discriminator}}
{{^discriminator}}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
{{/discriminator}}
{{#parent}}
{{^isArray}}
{{^isMap}}
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
{{/isMap}}
{{/isArray}}
{{/parent}}
{{#vars}}
{{#hasValidation}}
{{^isEnum}}
{{#maxLength}}
// {{{name}}} ({{{dataType}}}) maxLength
if (this.{{{name}}} != null && this.{{{name}}}.Length > {{maxLength}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be less than {{maxLength}}.", new [] { "{{{name}}}" });
}
{{/maxLength}}
{{#minLength}}
// {{{name}}} ({{{dataType}}}) minLength
if (this.{{{name}}} != null && this.{{{name}}}.Length < {{minLength}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be greater than {{minLength}}.", new [] { "{{{name}}}" });
}
{{/minLength}}
{{#maximum}}
// {{{name}}} ({{{dataType}}}) maximum
if (this.{{{name}}} > ({{{dataType}}}){{maximum}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" });
}
{{/maximum}}
{{#minimum}}
// {{{name}}} ({{{dataType}}}) minimum
if (this.{{{name}}} < ({{{dataType}}}){{minimum}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" });
}
{{/minimum}}
{{#pattern}}
{{^isByteArray}}
// {{{name}}} ({{{dataType}}}) pattern
Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}});
if (false == regex{{{name}}}.Match(this.{{{name}}}).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" });
}
{{/isByteArray}}
{{/pattern}}
{{/isEnum}}
{{/hasValidation}}
{{/vars}}
yield break;
}
{{>validatable}}
{{/validatable}}
}

View File

@ -6,7 +6,9 @@
/// <value>{{.}}</value>
{{/description}}
{{#isString}}
{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/useGenericHost}}
{{/isString}}
{{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{

View File

@ -27,8 +27,10 @@
{{#useCompareNetObjects}}
<PackageReference Include="CompareNETObjects" Version="4.61.0" />
{{/useCompareNetObjects}}
{{^useGenericHost}}
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
{{/useGenericHost}}
{{#useRestSharp}}
<PackageReference Include="RestSharp" Version="106.13.0" />
{{/useRestSharp}}

View File

@ -0,0 +1,89 @@
{{#discriminator}}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
{{/discriminator}}
{{^discriminator}}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
{{/discriminator}}
{{#parent}}
{{^isArray}}
{{^isMap}}
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
{{/isMap}}
{{/isArray}}
{{/parent}}
{{#vars}}
{{#hasValidation}}
{{^isEnum}}
{{#maxLength}}
// {{{name}}} ({{{dataType}}}) maxLength
if (this.{{{name}}} != null && this.{{{name}}}.Length > {{maxLength}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be less than {{maxLength}}.", new [] { "{{{name}}}" });
}
{{/maxLength}}
{{#minLength}}
// {{{name}}} ({{{dataType}}}) minLength
if (this.{{{name}}} != null && this.{{{name}}}.Length < {{minLength}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be greater than {{minLength}}.", new [] { "{{{name}}}" });
}
{{/minLength}}
{{#maximum}}
// {{{name}}} ({{{dataType}}}) maximum
if (this.{{{name}}} > ({{{dataType}}}){{maximum}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" });
}
{{/maximum}}
{{#minimum}}
// {{{name}}} ({{{dataType}}}) minimum
if (this.{{{name}}} < ({{{dataType}}}){{minimum}})
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" });
}
{{/minimum}}
{{#pattern}}
{{^isByteArray}}
// {{{name}}} ({{{dataType}}}) pattern
Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}});
if (false == regex{{{name}}}.Match(this.{{{name}}}).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" });
}
{{/isByteArray}}
{{/pattern}}
{{/isEnum}}
{{/hasValidation}}
{{/vars}}
yield break;
}

View File

@ -4,7 +4,9 @@
{{#description}}
/// <value>{{.}}</value>
{{/description}}
{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/useGenericHost}}
{{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
{
{{#allowableValues}}

View File

@ -4,9 +4,9 @@
{{#description}}
/// <value>{{.}}</value>
{{/description}}
{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}
{{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
{{/useGenericHost}}{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
{{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{
{{#allowableValues}}

View File

@ -6,7 +6,9 @@
/// <value>{{.}}</value>
{{/description}}
{{#isString}}
{{^useGenericHost}}
[JsonConverter(typeof(StringEnumConverter))]
{{/useGenericHost}}
{{/isString}}
{{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{

View File

@ -52,6 +52,9 @@ components:
$ref: "#/components/schemas/Child"
Child:
description: A representation of a child
properties:
boosterSeat:
type: boolean
allOf:
- type: object
properties:

View File

@ -108,12 +108,11 @@ src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs
src/Org.OpenAPITools/Client/HttpSigningToken.cs
src/Org.OpenAPITools/Client/IApi.cs
src/Org.OpenAPITools/Client/OAuthToken.cs
src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs
src/Org.OpenAPITools/Client/OpenAPIDateJsonConverter.cs
src/Org.OpenAPITools/Client/RateLimitProvider`1.cs
src/Org.OpenAPITools/Client/TokenBase.cs
src/Org.OpenAPITools/Client/TokenContainer`1.cs
src/Org.OpenAPITools/Client/TokenProvider`1.cs
src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs
src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/Animal.cs
src/Org.OpenAPITools/Model/ApiResponse.cs

View File

@ -6,7 +6,6 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
**Declawed** | **bool** | | [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

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**PetType** | **string** | | [default to PetTypeEnum.ChildCat]
**Name** | **string** | | [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

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -6,7 +6,6 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
**Breed** | **string** | | [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

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,9 +5,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**LengthCm** | **decimal** | | [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

@ -4,10 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | |
**LengthCm** | **decimal** | |
**Mealy** | **bool** | | [optional]
**Sweet** | **bool** | | [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

@ -5,9 +5,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**LengthCm** | **decimal** | | [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

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -4,10 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**HasBaleen** | **bool** | | [optional]
**HasTeeth** | **bool** | | [optional]
**Type** | **string** | | [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

@ -5,7 +5,7 @@ Model for testing model name same as property name
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Name** | **int** | |
**NameProperty** | **int** | |
**SnakeCase** | **int** | | [optional] [readonly]
**Property** | **string** | | [optional]
**_123Number** | **int** | | [optional] [readonly]

View File

@ -5,8 +5,6 @@ The value may be a shape or the 'null' value. The 'nullable' attribute was intro
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -4,7 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,7 +5,7 @@ Model for testing reserved words
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Return** | **int** | | [optional]
**ReturnProperty** | **int** | | [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

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -4,7 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,7 +5,6 @@ The value may be a shape or the 'null' value. This is introduced in OAS schema >
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -4,8 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SpecialPropertyName** | **long** | | [optional]
**_SpecialModelName** | **string** | | [optional]
**SpecialModelNameProperty** | **string** | | [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

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Declawed'
/// </summary>
[Fact]
public void DeclawedTest()
{
// TODO unit test for the property 'Declawed'
}
}

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
/// <summary>
/// Test the property 'Name'
/// </summary>
@ -72,6 +64,14 @@ namespace Org.OpenAPITools.Test.Model
{
// TODO unit test for the property 'Name'
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Name'
/// </summary>
[Fact]
public void NameTest()
{
// TODO unit test for the property 'Name'
}
/// <summary>
/// Test the property 'PetType'
/// </summary>
[Fact]
public void PetTypeTest()
{
// TODO unit test for the property 'PetType'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'QuadrilateralType'
/// </summary>
[Fact]
public void QuadrilateralTypeTest()
{
// TODO unit test for the property 'QuadrilateralType'
}
}

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Breed'
/// </summary>
[Fact]
public void BreedTest()
{
// TODO unit test for the property 'Breed'
}
}

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'EnumString'
/// </summary>
[Fact]
public void EnumStringTest()
{
// TODO unit test for the property 'EnumString'
}
/// <summary>
/// Test the property 'EnumStringRequired'
/// </summary>
@ -73,6 +65,14 @@ namespace Org.OpenAPITools.Test.Model
// TODO unit test for the property 'EnumStringRequired'
}
/// <summary>
/// Test the property 'EnumString'
/// </summary>
[Fact]
public void EnumStringTest()
{
// TODO unit test for the property 'EnumString'
}
/// <summary>
/// Test the property 'EnumInteger'
/// </summary>
[Fact]

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'TriangleType'
/// </summary>
[Fact]
public void TriangleTypeTest()
{
// TODO unit test for the property 'TriangleType'
}
}

View File

@ -56,6 +56,38 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Number'
/// </summary>
[Fact]
public void NumberTest()
{
// TODO unit test for the property 'Number'
}
/// <summary>
/// Test the property 'Byte'
/// </summary>
[Fact]
public void ByteTest()
{
// TODO unit test for the property 'Byte'
}
/// <summary>
/// Test the property 'Date'
/// </summary>
[Fact]
public void DateTest()
{
// TODO unit test for the property 'Date'
}
/// <summary>
/// Test the property 'Password'
/// </summary>
[Fact]
public void PasswordTest()
{
// TODO unit test for the property 'Password'
}
/// <summary>
/// Test the property 'Integer'
/// </summary>
@ -81,14 +113,6 @@ namespace Org.OpenAPITools.Test.Model
// TODO unit test for the property 'Int64'
}
/// <summary>
/// Test the property 'Number'
/// </summary>
[Fact]
public void NumberTest()
{
// TODO unit test for the property 'Number'
}
/// <summary>
/// Test the property 'Float'
/// </summary>
[Fact]
@ -121,14 +145,6 @@ namespace Org.OpenAPITools.Test.Model
// TODO unit test for the property 'String'
}
/// <summary>
/// Test the property 'Byte'
/// </summary>
[Fact]
public void ByteTest()
{
// TODO unit test for the property 'Byte'
}
/// <summary>
/// Test the property 'Binary'
/// </summary>
[Fact]
@ -137,14 +153,6 @@ namespace Org.OpenAPITools.Test.Model
// TODO unit test for the property 'Binary'
}
/// <summary>
/// Test the property 'Date'
/// </summary>
[Fact]
public void DateTest()
{
// TODO unit test for the property 'Date'
}
/// <summary>
/// Test the property 'DateTime'
/// </summary>
[Fact]
@ -161,14 +169,6 @@ namespace Org.OpenAPITools.Test.Model
// TODO unit test for the property 'Uuid'
}
/// <summary>
/// Test the property 'Password'
/// </summary>
[Fact]
public void PasswordTest()
{
// TODO unit test for the property 'Password'
}
/// <summary>
/// Test the property 'PatternWithDigits'
/// </summary>
[Fact]

View File

@ -56,38 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Cultivar'
/// </summary>
[Fact]
public void CultivarTest()
{
// TODO unit test for the property 'Cultivar'
}
/// <summary>
/// Test the property 'Mealy'
/// </summary>
[Fact]
public void MealyTest()
{
// TODO unit test for the property 'Mealy'
}
/// <summary>
/// Test the property 'LengthCm'
/// </summary>
[Fact]
public void LengthCmTest()
{
// TODO unit test for the property 'LengthCm'
}
/// <summary>
/// Test the property 'Sweet'
/// </summary>
[Fact]
public void SweetTest()
{
// TODO unit test for the property 'Sweet'
}
}

View File

@ -64,30 +64,6 @@ namespace Org.OpenAPITools.Test.Model
{
// TODO unit test for the property 'Color'
}
/// <summary>
/// Test the property 'Cultivar'
/// </summary>
[Fact]
public void CultivarTest()
{
// TODO unit test for the property 'Cultivar'
}
/// <summary>
/// Test the property 'Origin'
/// </summary>
[Fact]
public void OriginTest()
{
// TODO unit test for the property 'Origin'
}
/// <summary>
/// Test the property 'LengthCm'
/// </summary>
[Fact]
public void LengthCmTest()
{
// TODO unit test for the property 'LengthCm'
}
}

View File

@ -64,30 +64,6 @@ namespace Org.OpenAPITools.Test.Model
{
// TODO unit test for the property 'Color'
}
/// <summary>
/// Test the property 'Cultivar'
/// </summary>
[Fact]
public void CultivarTest()
{
// TODO unit test for the property 'Cultivar'
}
/// <summary>
/// Test the property 'Origin'
/// </summary>
[Fact]
public void OriginTest()
{
// TODO unit test for the property 'Origin'
}
/// <summary>
/// Test the property 'LengthCm'
/// </summary>
[Fact]
public void LengthCmTest()
{
// TODO unit test for the property 'LengthCm'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'TriangleType'
/// </summary>
[Fact]
public void TriangleTypeTest()
{
// TODO unit test for the property 'TriangleType'
}
}

View File

@ -56,38 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'HasBaleen'
/// </summary>
[Fact]
public void HasBaleenTest()
{
// TODO unit test for the property 'HasBaleen'
}
/// <summary>
/// Test the property 'HasTeeth'
/// </summary>
[Fact]
public void HasTeethTest()
{
// TODO unit test for the property 'HasTeeth'
}
/// <summary>
/// Test the property 'ClassName'
/// </summary>
[Fact]
public void ClassNameTest()
{
// TODO unit test for the property 'ClassName'
}
/// <summary>
/// Test the property 'Type'
/// </summary>
[Fact]
public void TypeTest()
{
// TODO unit test for the property 'Type'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'QuadrilateralType'
/// </summary>
[Fact]
public void QuadrilateralTypeTest()
{
// TODO unit test for the property 'QuadrilateralType'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
/// <summary>
/// Test the property 'Category'
/// </summary>
[Fact]
public void CategoryTest()
{
// TODO unit test for the property 'Category'
}
/// <summary>
/// Test the property 'Name'
/// </summary>
@ -89,6 +73,22 @@ namespace Org.OpenAPITools.Test.Model
// TODO unit test for the property 'PhotoUrls'
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
/// <summary>
/// Test the property 'Category'
/// </summary>
[Fact]
public void CategoryTest()
{
// TODO unit test for the property 'Category'
}
/// <summary>
/// Test the property 'Tags'
/// </summary>
[Fact]

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ClassName'
/// </summary>
[Fact]
public void ClassNameTest()
{
// TODO unit test for the property 'ClassName'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'QuadrilateralType'
/// </summary>
[Fact]
public void QuadrilateralTypeTest()
{
// TODO unit test for the property 'QuadrilateralType'
}
}

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'TriangleType'
/// </summary>
[Fact]
public void TriangleTypeTest()
{
// TODO unit test for the property 'TriangleType'
}
}

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'QuadrilateralType'
/// </summary>

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'QuadrilateralType'
/// </summary>

View File

@ -56,22 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ShapeType'
/// </summary>
[Fact]
public void ShapeTypeTest()
{
// TODO unit test for the property 'ShapeType'
}
/// <summary>
/// Test the property 'QuadrilateralType'
/// </summary>
[Fact]
public void QuadrilateralTypeTest()
{
// TODO unit test for the property 'QuadrilateralType'
}
}

View File

@ -56,6 +56,14 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'ClassName'
/// </summary>
[Fact]
public void ClassNameTest()
{
// TODO unit test for the property 'ClassName'
}
/// <summary>
/// Test the property 'HasBaleen'
/// </summary>
@ -72,14 +80,6 @@ namespace Org.OpenAPITools.Test.Model
{
// TODO unit test for the property 'HasTeeth'
}
/// <summary>
/// Test the property 'ClassName'
/// </summary>
[Fact]
public void ClassNameTest()
{
// TODO unit test for the property 'ClassName'
}
}

View File

@ -56,14 +56,6 @@ namespace Org.OpenAPITools.Test.Model
}
/// <summary>
/// Test the property 'Type'
/// </summary>
[Fact]
public void TypeTest()
{
// TODO unit test for the property 'Type'
}
/// <summary>
/// Test the property 'ClassName'
/// </summary>
@ -72,6 +64,14 @@ namespace Org.OpenAPITools.Test.Model
{
// TODO unit test for the property 'ClassName'
}
/// <summary>
/// Test the property 'Type'
/// </summary>
[Fact]
public void TypeTest()
{
// TODO unit test for the property 'Type'
}
}

View File

@ -197,7 +197,8 @@ namespace Org.OpenAPITools.Api
if ((modelClient as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -219,7 +220,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Patch;
request.Method = HttpMethod.Patch;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -242,7 +243,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient?> apiResponse = new ApiResponse<ModelClient?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}

View File

@ -192,7 +192,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -215,7 +215,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<InlineResponseDefault?> apiResponse = new ApiResponse<InlineResponseDefault?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<InlineResponseDefault>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<InlineResponseDefault>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}

View File

@ -772,7 +772,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -795,7 +795,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<HealthCheckResult?> apiResponse = new ApiResponse<HealthCheckResult?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<HealthCheckResult>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<HealthCheckResult>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -869,7 +869,8 @@ namespace Org.OpenAPITools.Api
if ((body as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -891,7 +892,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -914,7 +915,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<bool?> apiResponse = new ApiResponse<bool?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<bool>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<bool>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -988,7 +989,8 @@ namespace Org.OpenAPITools.Api
if ((outerComposite as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(outerComposite, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(outerComposite, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(outerComposite, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1010,7 +1012,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1033,7 +1035,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<OuterComposite?> apiResponse = new ApiResponse<OuterComposite?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<OuterComposite>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<OuterComposite>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1107,7 +1109,8 @@ namespace Org.OpenAPITools.Api
if ((body as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1129,7 +1132,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1152,7 +1155,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<decimal?> apiResponse = new ApiResponse<decimal?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<decimal>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<decimal>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1226,7 +1229,8 @@ namespace Org.OpenAPITools.Api
if ((body as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1248,7 +1252,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1271,7 +1275,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<string?> apiResponse = new ApiResponse<string?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<string>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1350,7 +1354,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1373,7 +1377,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<OuterEnum>?> apiResponse = new ApiResponse<List<OuterEnum>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<List<OuterEnum>>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<OuterEnum>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1454,7 +1458,8 @@ namespace Org.OpenAPITools.Api
if ((fileSchemaTestClass as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(fileSchemaTestClass, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(fileSchemaTestClass, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(fileSchemaTestClass, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1467,7 +1472,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Put;
request.Method = HttpMethod.Put;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1490,7 +1495,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1583,7 +1588,8 @@ namespace Org.OpenAPITools.Api
if ((user as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1596,7 +1602,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Put;
request.Method = HttpMethod.Put;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1619,7 +1625,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1700,7 +1706,8 @@ namespace Org.OpenAPITools.Api
if ((modelClient as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1722,7 +1729,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Patch;
request.Method = HttpMethod.Patch;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1745,7 +1752,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient?> apiResponse = new ApiResponse<ModelClient?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1936,7 +1943,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1959,7 +1966,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -2100,7 +2107,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -2123,7 +2130,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -2250,7 +2257,7 @@ namespace Org.OpenAPITools.Api
bearerToken.UseInHeader(request, "");
request.Method = HttpMethod.Delete;
request.Method = HttpMethod.Delete;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -2273,7 +2280,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -2357,7 +2364,8 @@ namespace Org.OpenAPITools.Api
if ((requestBody as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestBody, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestBody, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(requestBody, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -2370,7 +2378,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -2393,7 +2401,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -2500,7 +2508,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -2523,7 +2531,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -2637,7 +2645,7 @@ namespace Org.OpenAPITools.Api
request.RequestUri = uriBuilder.Uri;
request.Method = HttpMethod.Put;
request.Method = HttpMethod.Put;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -2660,7 +2668,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}

View File

@ -199,7 +199,8 @@ namespace Org.OpenAPITools.Api
if ((modelClient as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -231,7 +232,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Patch;
request.Method = HttpMethod.Patch;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -254,7 +255,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient?> apiResponse = new ApiResponse<ModelClient?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();

View File

@ -498,7 +498,8 @@ namespace Org.OpenAPITools.Api
if ((pet as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(pet, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(pet, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(pet, ClientUtils.JsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -528,7 +529,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -551,7 +552,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -652,7 +653,7 @@ namespace Org.OpenAPITools.Api
oauthToken.UseInHeader(request, "");
request.Method = HttpMethod.Delete;
request.Method = HttpMethod.Delete;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -675,7 +676,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -790,7 +791,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -813,7 +814,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<Pet>?> apiResponse = new ApiResponse<List<Pet>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -931,7 +932,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -954,7 +955,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<Pet>?> apiResponse = new ApiResponse<List<Pet>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1059,7 +1060,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1082,7 +1083,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Pet?> apiResponse = new ApiResponse<Pet?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<Pet>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Pet>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1166,7 +1167,8 @@ namespace Org.OpenAPITools.Api
if ((pet as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(pet, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(pet, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(pet, ClientUtils.JsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -1196,7 +1198,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Put;
request.Method = HttpMethod.Put;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1219,7 +1221,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1343,7 +1345,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1366,7 +1368,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1496,7 +1498,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1519,7 +1521,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ApiResponse?> apiResponse = new ApiResponse<ApiResponse?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1651,7 +1653,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1674,7 +1676,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ApiResponse?> apiResponse = new ApiResponse<ApiResponse?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();

View File

@ -299,7 +299,7 @@ namespace Org.OpenAPITools.Api
request.RequestUri = uriBuilder.Uri;
request.Method = HttpMethod.Delete;
request.Method = HttpMethod.Delete;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -322,7 +322,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -409,7 +409,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -432,7 +432,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Dictionary<string, int>?> apiResponse = new ApiResponse<Dictionary<string, int>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, int>>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, int>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -526,7 +526,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -549,7 +549,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Order?> apiResponse = new ApiResponse<Order?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -630,7 +630,8 @@ namespace Org.OpenAPITools.Api
if ((order as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(order, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(order, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(order, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -653,7 +654,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -676,7 +677,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Order?> apiResponse = new ApiResponse<Order?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}

View File

@ -445,7 +445,8 @@ namespace Org.OpenAPITools.Api
if ((user as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -458,7 +459,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -481,7 +482,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -562,7 +563,8 @@ namespace Org.OpenAPITools.Api
if ((user as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -575,7 +577,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -598,7 +600,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -679,7 +681,8 @@ namespace Org.OpenAPITools.Api
if ((user as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -692,7 +695,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Post;
request.Method = HttpMethod.Post;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -715,7 +718,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -796,7 +799,7 @@ namespace Org.OpenAPITools.Api
request.RequestUri = uriBuilder.Uri;
request.Method = HttpMethod.Delete;
request.Method = HttpMethod.Delete;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -819,7 +822,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -910,7 +913,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -933,7 +936,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<User?> apiResponse = new ApiResponse<User?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<User>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<User>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1036,7 +1039,7 @@ namespace Org.OpenAPITools.Api
if (accept != null)
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1059,7 +1062,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<string?> apiResponse = new ApiResponse<string?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<string>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1129,7 +1132,7 @@ namespace Org.OpenAPITools.Api
request.RequestUri = uriBuilder.Uri;
request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1152,7 +1155,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}
@ -1240,7 +1243,8 @@ namespace Org.OpenAPITools.Api
if ((user as object) is System.IO.Stream stream)
request.Content = new StreamContent(stream);
else
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
// request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user, ClientUtils.JsonSerializerSettings));
request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1253,7 +1257,7 @@ namespace Org.OpenAPITools.Api
if (contentType != null)
request.Content.Headers.Add("ContentType", contentType);
request.Method = HttpMethod.Put;
request.Method = HttpMethod.Put;
using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
{
@ -1276,7 +1280,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(apiResponse.RawContent, ClientUtils.JsonSerializerSettings);
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
return apiResponse;
}

View File

@ -13,7 +13,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Client
{

View File

@ -52,21 +52,53 @@ namespace Org.OpenAPITools.Client
public delegate void EventHandler<T>(object sender, T e) where T : EventArgs;
/// <summary>
/// Custom JSON serializer
/// Returns true when deserialization succeeds.
/// </summary>
public static Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get; set; } = new Newtonsoft.Json.JsonSerializerSettings
/// <typeparam name="T"></typeparam>
/// <param name="json"></param>
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(string json, System.Text.Json.JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = Newtonsoft.Json.ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore,
ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver
try
{
NamingStrategy = new Newtonsoft.Json.Serialization.CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
result = System.Text.Json.JsonSerializer.Deserialize<T>(json, options);
return result != null;
}
};
catch (Exception)
{
result = default;
return false;
}
}
/// <summary>
/// Returns true when deserialization succeeds.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reader"></param>
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(ref reader, options);
return result != null;
}
catch (Exception)
{
result = default;
return false;
}
}
/// <summary>
/// Json serializer options
/// </summary>
public static System.Text.Json.JsonSerializerOptions JsonSerializerOptions { get; set; } = new System.Text.Json.JsonSerializerOptions();
/// <summary>
/// Sanitize filename by removing the path
@ -175,7 +207,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
/// <param name="contentTypes">The Content-Type array to select from.</param>
/// <returns>The Content-Type header to use.</returns>
public static string SelectHeaderContentType(string[] contentTypes)
public static string? SelectHeaderContentType(string[] contentTypes)
{
if (contentTypes.Length == 0)
return null;
@ -196,7 +228,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
/// <param name="accepts">The accepts array to select from.</param>
/// <returns>The Accept header to use.</returns>
public static string SelectHeaderAccept(string[] accepts)
public static string? SelectHeaderAccept(string[] accepts)
{
if (accepts.Length == 0)
return null;

View File

@ -14,6 +14,7 @@ using System.Linq;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Client
{
@ -89,6 +90,26 @@ namespace Org.OpenAPITools.Client
public HostConfiguration AddApiHttpClients(
Action<HttpClient>? client = null, Action<IHttpClientBuilder>? builder = null)
{
ClientUtils.JsonSerializerOptions.Converters.Add(new OpenAPIDateJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new CatJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ChildCatJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new DogJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new EquilateralTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new FruitJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new FruitReqJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new GmFruitJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new MammalJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new NullableShapeJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new PigJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new QuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ScaleneTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ShapeJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ShapeOrNullJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new SimpleQuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new TriangleJsonConverter());
AddApiHttpClients<AnotherFakeApi, DefaultApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi>(client, builder);
return this;
@ -99,9 +120,9 @@ namespace Org.OpenAPITools.Client
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public HostConfiguration ConfigureJsonOptions(Action<Newtonsoft.Json.JsonSerializerSettings> options)
public HostConfiguration ConfigureJsonOptions(Action<System.Text.Json.JsonSerializerOptions> options)
{
options(Client.ClientUtils.JsonSerializerSettings);
options(Client.ClientUtils.JsonSerializerOptions);
return this;
}

View File

@ -1,29 +0,0 @@
/*
* 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 Newtonsoft.Json.Converters;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class OpenAPIDateConverter : IsoDateTimeConverter
{
/// <summary>
/// Initializes a new instance of the <see cref="OpenAPIDateConverter" /> class.
/// </summary>
public OpenAPIDateConverter()
{
// full-date = date-fullyear "-" date-month "-" date-mday
DateTimeFormat = "yyyy-MM-dd";
}
}
}

View File

@ -0,0 +1,42 @@
/*
* 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.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class OpenAPIDateJsonConverter : JsonConverter<DateTime>
{
/// <summary>
/// Returns a DateTime from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
DateTime.ParseExact(reader.GetString()!, "yyyy-MM-dd", CultureInfo.InvariantCulture);
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateTimeValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateTimeValue.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
}
}

View File

@ -1,76 +0,0 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification
/// </summary>
public abstract partial class AbstractOpenAPISchema
{
/// <summary>
/// Custom JSON serializer
/// </summary>
static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = MissingMemberHandling.Error,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
/// <summary>
/// Custom JSON serializer for objects with additional properties
/// </summary>
static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = MissingMemberHandling.Ignore,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
/// <summary>
/// Gets or Sets the actual instance
/// </summary>
public abstract Object ActualInstance { get; set; }
/// <summary>
/// Gets or Sets IsNullable to indicate whether the instance is nullable
/// </summary>
public bool IsNullable { get; protected set; }
/// <summary>
/// Gets or Sets the schema type, which can be either `oneOf` or `anyOf`
/// </summary>
public string SchemaType { get; protected set; }
/// <summary>
/// Converts the instance into JSON string.
/// </summary>
public abstract string ToJson();
}
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,87 +29,85 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// AdditionalPropertiesClass
/// </summary>
[DataContract(Name = "AdditionalPropertiesClass")]
public partial class AdditionalPropertiesClass : IEquatable<AdditionalPropertiesClass>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="AdditionalPropertiesClass" /> class.
/// </summary>
/// <param name="mapProperty">mapProperty.</param>
/// <param name="mapOfMapProperty">mapOfMapProperty.</param>
/// <param name="anytype1">anytype1.</param>
/// <param name="mapWithUndeclaredPropertiesAnytype1">mapWithUndeclaredPropertiesAnytype1.</param>
/// <param name="mapWithUndeclaredPropertiesAnytype2">mapWithUndeclaredPropertiesAnytype2.</param>
/// <param name="mapWithUndeclaredPropertiesAnytype3">mapWithUndeclaredPropertiesAnytype3.</param>
/// <param name="emptyMap">an object with no declared properties and no undeclared properties, hence it&#39;s an empty map..</param>
/// <param name="mapWithUndeclaredPropertiesString">mapWithUndeclaredPropertiesString.</param>
/// <param name="mapProperty">mapProperty</param>
/// <param name="mapOfMapProperty">mapOfMapProperty</param>
/// <param name="anytype1">anytype1</param>
/// <param name="mapWithUndeclaredPropertiesAnytype1">mapWithUndeclaredPropertiesAnytype1</param>
/// <param name="mapWithUndeclaredPropertiesAnytype2">mapWithUndeclaredPropertiesAnytype2</param>
/// <param name="mapWithUndeclaredPropertiesAnytype3">mapWithUndeclaredPropertiesAnytype3</param>
/// <param name="emptyMap">an object with no declared properties and no undeclared properties, hence it&#39;s an empty map.</param>
/// <param name="mapWithUndeclaredPropertiesString">mapWithUndeclaredPropertiesString</param>
public AdditionalPropertiesClass(Dictionary<string, string>? mapProperty = default, Dictionary<string, Dictionary<string, string>>? mapOfMapProperty = default, Object? anytype1 = default, Object? mapWithUndeclaredPropertiesAnytype1 = default, Object? mapWithUndeclaredPropertiesAnytype2 = default, Dictionary<string, Object>? mapWithUndeclaredPropertiesAnytype3 = default, Object? emptyMap = default, Dictionary<string, string>? mapWithUndeclaredPropertiesString = default)
{
this.MapProperty = mapProperty;
this.MapOfMapProperty = mapOfMapProperty;
this.Anytype1 = anytype1;
this.MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1;
this.MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2;
this.MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3;
this.EmptyMap = emptyMap;
this.MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
this.AdditionalProperties = new Dictionary<string, object>();
MapProperty = mapProperty;
MapOfMapProperty = mapOfMapProperty;
Anytype1 = anytype1;
MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1;
MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2;
MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3;
EmptyMap = emptyMap;
MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
}
/// <summary>
/// Gets or Sets MapProperty
/// </summary>
[DataMember(Name = "map_property", EmitDefaultValue = false)]
[JsonPropertyName("map_property")]
public Dictionary<string, string>? MapProperty { get; set; }
/// <summary>
/// Gets or Sets MapOfMapProperty
/// </summary>
[DataMember(Name = "map_of_map_property", EmitDefaultValue = false)]
[JsonPropertyName("map_of_map_property")]
public Dictionary<string, Dictionary<string, string>>? MapOfMapProperty { get; set; }
/// <summary>
/// Gets or Sets Anytype1
/// </summary>
[DataMember(Name = "anytype_1", EmitDefaultValue = true)]
[JsonPropertyName("anytype_1")]
public Object? Anytype1 { get; set; }
/// <summary>
/// Gets or Sets MapWithUndeclaredPropertiesAnytype1
/// </summary>
[DataMember(Name = "map_with_undeclared_properties_anytype_1", EmitDefaultValue = false)]
[JsonPropertyName("map_with_undeclared_properties_anytype_1")]
public Object? MapWithUndeclaredPropertiesAnytype1 { get; set; }
/// <summary>
/// Gets or Sets MapWithUndeclaredPropertiesAnytype2
/// </summary>
[DataMember(Name = "map_with_undeclared_properties_anytype_2", EmitDefaultValue = false)]
[JsonPropertyName("map_with_undeclared_properties_anytype_2")]
public Object? MapWithUndeclaredPropertiesAnytype2 { get; set; }
/// <summary>
/// Gets or Sets MapWithUndeclaredPropertiesAnytype3
/// </summary>
[DataMember(Name = "map_with_undeclared_properties_anytype_3", EmitDefaultValue = false)]
[JsonPropertyName("map_with_undeclared_properties_anytype_3")]
public Dictionary<string, Object>? MapWithUndeclaredPropertiesAnytype3 { get; set; }
/// <summary>
/// an object with no declared properties and no undeclared properties, hence it&#39;s an empty map.
/// </summary>
/// <value>an object with no declared properties and no undeclared properties, hence it&#39;s an empty map.</value>
[DataMember(Name = "empty_map", EmitDefaultValue = false)]
[JsonPropertyName("empty_map")]
public Object? EmptyMap { get; set; }
/// <summary>
/// Gets or Sets MapWithUndeclaredPropertiesString
/// </summary>
[DataMember(Name = "map_with_undeclared_properties_string", EmitDefaultValue = false)]
[JsonPropertyName("map_with_undeclared_properties_string")]
public Dictionary<string, string>? MapWithUndeclaredPropertiesString { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -132,21 +130,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as AdditionalPropertiesClass).AreEqual;
}
@ -156,7 +145,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of AdditionalPropertiesClass to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(AdditionalPropertiesClass input)
public bool Equals(AdditionalPropertiesClass? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,12 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using JsonSubTypes;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -30,54 +29,38 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Animal
/// </summary>
[DataContract(Name = "Animal")]
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
public partial class Animal : IEquatable<Animal>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Animal" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Animal()
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="Animal" /> class.
/// </summary>
/// <param name="className">className (required).</param>
/// <param name="color">color (default to &quot;red&quot;).</param>
/// <param name="className">className (required)</param>
/// <param name="color">color (default to &quot;red&quot;)</param>
public Animal(string className, string? color = "red")
{
// to ensure "className" is required (not null)
if (className == null) {
throw new ArgumentNullException("className is a required property for Animal and cannot be null");
}
this.ClassName = className;
// use default value if no "color" provided
this.Color = color ?? "red";
this.AdditionalProperties = new Dictionary<string, object>();
if (className == null)
throw new ArgumentNullException("className is a required property for Animal and cannot be null.");
ClassName = className;
Color = color;
}
/// <summary>
/// Gets or Sets ClassName
/// </summary>
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
[JsonPropertyName("className")]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Color
/// </summary>
[DataMember(Name = "color", EmitDefaultValue = false)]
[JsonPropertyName("color")]
public string? Color { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -94,21 +77,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Animal).AreEqual;
}
@ -118,7 +92,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Animal to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Animal input)
public bool Equals(Animal? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,46 +29,44 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ApiResponse
/// </summary>
[DataContract(Name = "ApiResponse")]
public partial class ApiResponse : IEquatable<ApiResponse>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse" /> class.
/// </summary>
/// <param name="code">code.</param>
/// <param name="type">type.</param>
/// <param name="message">message.</param>
/// <param name="code">code</param>
/// <param name="type">type</param>
/// <param name="message">message</param>
public ApiResponse(int? code = default, string? type = default, string? message = default)
{
this.Code = code;
this.Type = type;
this.Message = message;
this.AdditionalProperties = new Dictionary<string, object>();
Code = code;
Type = type;
Message = message;
}
/// <summary>
/// Gets or Sets Code
/// </summary>
[DataMember(Name = "code", EmitDefaultValue = false)]
[JsonPropertyName("code")]
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = false)]
[JsonPropertyName("type")]
public string? Type { get; set; }
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name = "message", EmitDefaultValue = false)]
[JsonPropertyName("message")]
public string? Message { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -86,21 +84,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ApiResponse).AreEqual;
}
@ -110,7 +99,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ApiResponse to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ApiResponse input)
public bool Equals(ApiResponse? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,38 +29,36 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Apple
/// </summary>
[DataContract(Name = "apple")]
public partial class Apple : IEquatable<Apple>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Apple" /> class.
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
/// <param name="cultivar">cultivar</param>
/// <param name="origin">origin</param>
public Apple(string? cultivar = default, string? origin = default)
{
this.Cultivar = cultivar;
this.Origin = origin;
this.AdditionalProperties = new Dictionary<string, object>();
Cultivar = cultivar;
Origin = origin;
}
/// <summary>
/// Gets or Sets Cultivar
/// </summary>
[DataMember(Name = "cultivar", EmitDefaultValue = false)]
[JsonPropertyName("cultivar")]
public string? Cultivar { get; set; }
/// <summary>
/// Gets or Sets Origin
/// </summary>
[DataMember(Name = "origin", EmitDefaultValue = false)]
[JsonPropertyName("origin")]
public string? Origin { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -77,21 +75,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Apple).AreEqual;
}
@ -101,7 +90,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Apple to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Apple input)
public bool Equals(Apple? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,39 +29,31 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// AppleReq
/// </summary>
[DataContract(Name = "appleReq")]
public partial class AppleReq : IEquatable<AppleReq>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="AppleReq" /> class.
/// </summary>
[JsonConstructorAttribute]
protected AppleReq() { }
/// <summary>
/// Initializes a new instance of the <see cref="AppleReq" /> class.
/// </summary>
/// <param name="cultivar">cultivar (required).</param>
/// <param name="mealy">mealy.</param>
/// <param name="cultivar">cultivar (required)</param>
/// <param name="mealy">mealy</param>
public AppleReq(string cultivar, bool? mealy = default)
{
// to ensure "cultivar" is required (not null)
if (cultivar == null) {
throw new ArgumentNullException("cultivar is a required property for AppleReq and cannot be null");
}
this.Cultivar = cultivar;
this.Mealy = mealy;
if (cultivar == null)
throw new ArgumentNullException("cultivar is a required property for AppleReq and cannot be null.");
Cultivar = cultivar;
Mealy = mealy;
}
/// <summary>
/// Gets or Sets Cultivar
/// </summary>
[DataMember(Name = "cultivar", IsRequired = true, EmitDefaultValue = false)]
[JsonPropertyName("cultivar")]
public string Cultivar { get; set; }
/// <summary>
/// Gets or Sets Mealy
/// </summary>
[DataMember(Name = "mealy", EmitDefaultValue = true)]
[JsonPropertyName("mealy")]
public bool? Mealy { get; set; }
/// <summary>
@ -78,21 +70,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as AppleReq).AreEqual;
}
@ -102,7 +85,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of AppleReq to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(AppleReq input)
public bool Equals(AppleReq? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,30 +29,28 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ArrayOfArrayOfNumberOnly
/// </summary>
[DataContract(Name = "ArrayOfArrayOfNumberOnly")]
public partial class ArrayOfArrayOfNumberOnly : IEquatable<ArrayOfArrayOfNumberOnly>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ArrayOfArrayOfNumberOnly" /> class.
/// </summary>
/// <param name="arrayArrayNumber">arrayArrayNumber.</param>
/// <param name="arrayArrayNumber">arrayArrayNumber</param>
public ArrayOfArrayOfNumberOnly(List<List<decimal>>? arrayArrayNumber = default)
{
this.ArrayArrayNumber = arrayArrayNumber;
this.AdditionalProperties = new Dictionary<string, object>();
ArrayArrayNumber = arrayArrayNumber;
}
/// <summary>
/// Gets or Sets ArrayArrayNumber
/// </summary>
[DataMember(Name = "ArrayArrayNumber", EmitDefaultValue = false)]
[JsonPropertyName("ArrayArrayNumber")]
public List<List<decimal>>? ArrayArrayNumber { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -68,21 +66,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayOfArrayOfNumberOnly).AreEqual;
}
@ -92,7 +81,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ArrayOfArrayOfNumberOnly to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ArrayOfArrayOfNumberOnly input)
public bool Equals(ArrayOfArrayOfNumberOnly? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,30 +29,28 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ArrayOfNumberOnly
/// </summary>
[DataContract(Name = "ArrayOfNumberOnly")]
public partial class ArrayOfNumberOnly : IEquatable<ArrayOfNumberOnly>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ArrayOfNumberOnly" /> class.
/// </summary>
/// <param name="arrayNumber">arrayNumber.</param>
/// <param name="arrayNumber">arrayNumber</param>
public ArrayOfNumberOnly(List<decimal>? arrayNumber = default)
{
this.ArrayNumber = arrayNumber;
this.AdditionalProperties = new Dictionary<string, object>();
ArrayNumber = arrayNumber;
}
/// <summary>
/// Gets or Sets ArrayNumber
/// </summary>
[DataMember(Name = "ArrayNumber", EmitDefaultValue = false)]
[JsonPropertyName("ArrayNumber")]
public List<decimal>? ArrayNumber { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -68,21 +66,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayOfNumberOnly).AreEqual;
}
@ -92,7 +81,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ArrayOfNumberOnly to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ArrayOfNumberOnly input)
public bool Equals(ArrayOfNumberOnly? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,46 +29,44 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ArrayTest
/// </summary>
[DataContract(Name = "ArrayTest")]
public partial class ArrayTest : IEquatable<ArrayTest>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ArrayTest" /> class.
/// </summary>
/// <param name="arrayOfString">arrayOfString.</param>
/// <param name="arrayArrayOfInteger">arrayArrayOfInteger.</param>
/// <param name="arrayArrayOfModel">arrayArrayOfModel.</param>
/// <param name="arrayOfString">arrayOfString</param>
/// <param name="arrayArrayOfInteger">arrayArrayOfInteger</param>
/// <param name="arrayArrayOfModel">arrayArrayOfModel</param>
public ArrayTest(List<string>? arrayOfString = default, List<List<long>>? arrayArrayOfInteger = default, List<List<ReadOnlyFirst>>? arrayArrayOfModel = default)
{
this.ArrayOfString = arrayOfString;
this.ArrayArrayOfInteger = arrayArrayOfInteger;
this.ArrayArrayOfModel = arrayArrayOfModel;
this.AdditionalProperties = new Dictionary<string, object>();
ArrayOfString = arrayOfString;
ArrayArrayOfInteger = arrayArrayOfInteger;
ArrayArrayOfModel = arrayArrayOfModel;
}
/// <summary>
/// Gets or Sets ArrayOfString
/// </summary>
[DataMember(Name = "array_of_string", EmitDefaultValue = false)]
[JsonPropertyName("array_of_string")]
public List<string>? ArrayOfString { get; set; }
/// <summary>
/// Gets or Sets ArrayArrayOfInteger
/// </summary>
[DataMember(Name = "array_array_of_integer", EmitDefaultValue = false)]
[JsonPropertyName("array_array_of_integer")]
public List<List<long>>? ArrayArrayOfInteger { get; set; }
/// <summary>
/// Gets or Sets ArrayArrayOfModel
/// </summary>
[DataMember(Name = "array_array_of_model", EmitDefaultValue = false)]
[JsonPropertyName("array_array_of_model")]
public List<List<ReadOnlyFirst>>? ArrayArrayOfModel { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -86,21 +84,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayTest).AreEqual;
}
@ -110,7 +99,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ArrayTest to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ArrayTest input)
public bool Equals(ArrayTest? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,30 +29,28 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Banana
/// </summary>
[DataContract(Name = "banana")]
public partial class Banana : IEquatable<Banana>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Banana" /> class.
/// </summary>
/// <param name="lengthCm">lengthCm.</param>
/// <param name="lengthCm">lengthCm</param>
public Banana(decimal? lengthCm = default)
{
this.LengthCm = lengthCm;
this.AdditionalProperties = new Dictionary<string, object>();
LengthCm = lengthCm;
}
/// <summary>
/// Gets or Sets LengthCm
/// </summary>
[DataMember(Name = "lengthCm", EmitDefaultValue = false)]
[JsonPropertyName("lengthCm")]
public decimal? LengthCm { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -68,21 +66,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Banana).AreEqual;
}
@ -92,7 +81,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Banana to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Banana input)
public bool Equals(Banana? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,35 +29,31 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// BananaReq
/// </summary>
[DataContract(Name = "bananaReq")]
public partial class BananaReq : IEquatable<BananaReq>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="BananaReq" /> class.
/// </summary>
[JsonConstructorAttribute]
protected BananaReq() { }
/// <summary>
/// Initializes a new instance of the <see cref="BananaReq" /> class.
/// </summary>
/// <param name="lengthCm">lengthCm (required).</param>
/// <param name="sweet">sweet.</param>
/// <param name="lengthCm">lengthCm (required)</param>
/// <param name="sweet">sweet</param>
public BananaReq(decimal lengthCm, bool? sweet = default)
{
this.LengthCm = lengthCm;
this.Sweet = sweet;
if (lengthCm == null)
throw new ArgumentNullException("lengthCm is a required property for BananaReq and cannot be null.");
LengthCm = lengthCm;
Sweet = sweet;
}
/// <summary>
/// Gets or Sets LengthCm
/// </summary>
[DataMember(Name = "lengthCm", IsRequired = true, EmitDefaultValue = false)]
[JsonPropertyName("lengthCm")]
public decimal LengthCm { get; set; }
/// <summary>
/// Gets or Sets Sweet
/// </summary>
[DataMember(Name = "sweet", EmitDefaultValue = true)]
[JsonPropertyName("sweet")]
public bool? Sweet { get; set; }
/// <summary>
@ -74,21 +70,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as BananaReq).AreEqual;
}
@ -98,7 +85,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of BananaReq to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(BananaReq input)
public bool Equals(BananaReq? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,42 +29,30 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// BasquePig
/// </summary>
[DataContract(Name = "BasquePig")]
public partial class BasquePig : IEquatable<BasquePig>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="BasquePig" /> class.
/// </summary>
[JsonConstructorAttribute]
protected BasquePig()
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="BasquePig" /> class.
/// </summary>
/// <param name="className">className (required).</param>
/// <param name="className">className (required)</param>
public BasquePig(string className)
{
// to ensure "className" is required (not null)
if (className == null) {
throw new ArgumentNullException("className is a required property for BasquePig and cannot be null");
}
this.ClassName = className;
this.AdditionalProperties = new Dictionary<string, object>();
if (className == null)
throw new ArgumentNullException("className is a required property for BasquePig and cannot be null.");
ClassName = className;
}
/// <summary>
/// Gets or Sets ClassName
/// </summary>
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
[JsonPropertyName("className")]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -80,21 +68,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as BasquePig).AreEqual;
}
@ -104,7 +83,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of BasquePig to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(BasquePig input)
public bool Equals(BasquePig? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,71 +29,69 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Capitalization
/// </summary>
[DataContract(Name = "Capitalization")]
public partial class Capitalization : IEquatable<Capitalization>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Capitalization" /> class.
/// </summary>
/// <param name="smallCamel">smallCamel.</param>
/// <param name="capitalCamel">capitalCamel.</param>
/// <param name="smallSnake">smallSnake.</param>
/// <param name="capitalSnake">capitalSnake.</param>
/// <param name="sCAETHFlowPoints">sCAETHFlowPoints.</param>
/// <param name="aTTNAME">Name of the pet .</param>
/// <param name="smallCamel">smallCamel</param>
/// <param name="capitalCamel">capitalCamel</param>
/// <param name="smallSnake">smallSnake</param>
/// <param name="capitalSnake">capitalSnake</param>
/// <param name="sCAETHFlowPoints">sCAETHFlowPoints</param>
/// <param name="aTTNAME">Name of the pet </param>
public Capitalization(string? smallCamel = default, string? capitalCamel = default, string? smallSnake = default, string? capitalSnake = default, string? sCAETHFlowPoints = default, string? aTTNAME = default)
{
this.SmallCamel = smallCamel;
this.CapitalCamel = capitalCamel;
this.SmallSnake = smallSnake;
this.CapitalSnake = capitalSnake;
this.SCAETHFlowPoints = sCAETHFlowPoints;
this.ATT_NAME = aTTNAME;
this.AdditionalProperties = new Dictionary<string, object>();
SmallCamel = smallCamel;
CapitalCamel = capitalCamel;
SmallSnake = smallSnake;
CapitalSnake = capitalSnake;
SCAETHFlowPoints = sCAETHFlowPoints;
ATT_NAME = aTTNAME;
}
/// <summary>
/// Gets or Sets SmallCamel
/// </summary>
[DataMember(Name = "smallCamel", EmitDefaultValue = false)]
[JsonPropertyName("smallCamel")]
public string? SmallCamel { get; set; }
/// <summary>
/// Gets or Sets CapitalCamel
/// </summary>
[DataMember(Name = "CapitalCamel", EmitDefaultValue = false)]
[JsonPropertyName("CapitalCamel")]
public string? CapitalCamel { get; set; }
/// <summary>
/// Gets or Sets SmallSnake
/// </summary>
[DataMember(Name = "small_Snake", EmitDefaultValue = false)]
[JsonPropertyName("small_Snake")]
public string? SmallSnake { get; set; }
/// <summary>
/// Gets or Sets CapitalSnake
/// </summary>
[DataMember(Name = "Capital_Snake", EmitDefaultValue = false)]
[JsonPropertyName("Capital_Snake")]
public string? CapitalSnake { get; set; }
/// <summary>
/// Gets or Sets SCAETHFlowPoints
/// </summary>
[DataMember(Name = "SCA_ETH_Flow_Points", EmitDefaultValue = false)]
[JsonPropertyName("SCA_ETH_Flow_Points")]
public string? SCAETHFlowPoints { get; set; }
/// <summary>
/// Name of the pet
/// </summary>
/// <value>Name of the pet </value>
[DataMember(Name = "ATT_NAME", EmitDefaultValue = false)]
[JsonPropertyName("ATT_NAME")]
public string? ATT_NAME { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -114,21 +112,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Capitalization).AreEqual;
}
@ -138,7 +127,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Capitalization to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Capitalization input)
public bool Equals(Capitalization? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,12 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using JsonSubTypes;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -30,41 +29,23 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Cat
/// </summary>
[DataContract(Name = "Cat")]
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
public partial class Cat : Animal, IEquatable<Cat>, IValidatableObject
public partial class Cat : Animal, IEquatable<Cat>
{
/// <summary>
/// Initializes a new instance of the <see cref="Cat" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Cat()
/// <param name="catAllOf">catAllOf</param>
/// <param name="className">className (required)</param>
/// <param name="color">color (default to &quot;red&quot;)</param>
public Cat(CatAllOf catAllOf, string className, string? color = "red") : base(className, color)
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="Cat" /> class.
/// </summary>
/// <param name="className">className (required) (default to &quot;Cat&quot;).</param>
/// <param name="declawed">declawed.</param>
/// <param name="color">color (default to &quot;red&quot;).</param>
public Cat(string className = "Cat", bool? declawed = default, string? color = "red") : base(className, color)
{
this.Declawed = declawed;
this.AdditionalProperties = new Dictionary<string, object>();
CatAllOf = catAllOf;
}
/// <summary>
/// Gets or Sets Declawed
/// Gets or Sets Cat
/// </summary>
[DataMember(Name = "declawed", EmitDefaultValue = true)]
public bool? Declawed { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public CatAllOf? CatAllOf { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -75,27 +56,16 @@ namespace Org.OpenAPITools.Model
StringBuilder sb = new StringBuilder();
sb.Append("class Cat {\n");
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Cat).AreEqual;
}
@ -105,7 +75,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Cat to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Cat input)
public bool Equals(Cat? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@ -119,38 +89,76 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 59) + this.Declawed.GetHashCode();
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
}
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
yield break;
}
}
/// <summary>
/// A Json converter for type Cat
/// </summary>
public class CatJsonConverter : JsonConverter<Cat>
{
/// <summary>
/// Returns a boolean if the type is compatible with this converter.
/// </summary>
/// <param name="typeToConvert"></param>
/// <returns></returns>
public override bool CanConvert(Type typeToConvert) => typeof(Cat).IsAssignableFrom(typeToConvert);
/// <summary>
/// A Json reader.
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Cat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
int currentDepth = reader.CurrentDepth;
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
Utf8JsonReader catAllOfReader = reader;
Client.ClientUtils.TryDeserialize<CatAllOf>(ref catAllOfReader, options, out CatAllOf? catAllOf);
string? className = default;
string? color = default;
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
break;
if (reader.TokenType == JsonTokenType.PropertyName)
{
string? propertyName = reader.GetString();
reader.Read();
switch (propertyName)
{
case "className":
className = reader.GetString();
break;
case "color":
color = reader.GetString();
break;
}
}
}
return new Cat(catAllOf, className, color);
}
/// <summary>
/// A Json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="cat"></param>
/// <param name="options"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions options) => throw new NotImplementedException();
}
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,30 +29,28 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// CatAllOf
/// </summary>
[DataContract(Name = "Cat_allOf")]
public partial class CatAllOf : IEquatable<CatAllOf>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CatAllOf" /> class.
/// </summary>
/// <param name="declawed">declawed.</param>
/// <param name="declawed">declawed</param>
public CatAllOf(bool? declawed = default)
{
this.Declawed = declawed;
this.AdditionalProperties = new Dictionary<string, object>();
Declawed = declawed;
}
/// <summary>
/// Gets or Sets Declawed
/// </summary>
[DataMember(Name = "declawed", EmitDefaultValue = true)]
[JsonPropertyName("declawed")]
public bool? Declawed { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -68,21 +66,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as CatAllOf).AreEqual;
}
@ -92,7 +81,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of CatAllOf to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(CatAllOf input)
public bool Equals(CatAllOf? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,50 +29,38 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Category
/// </summary>
[DataContract(Name = "Category")]
public partial class Category : IEquatable<Category>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Category" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Category()
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="Category" /> class.
/// </summary>
/// <param name="name">name (required) (default to &quot;default-name&quot;).</param>
/// <param name="id">id.</param>
/// <param name="name">name (required) (default to &quot;default-name&quot;)</param>
/// <param name="id">id</param>
public Category(string name = "default-name", long? id = default)
{
// to ensure "name" is required (not null)
if (name == null) {
throw new ArgumentNullException("name is a required property for Category and cannot be null");
}
this.Name = name;
this.Id = id;
this.AdditionalProperties = new Dictionary<string, object>();
if (name == null)
throw new ArgumentNullException("name is a required property for Category and cannot be null.");
Name = name;
Id = id;
}
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)]
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
[JsonPropertyName("id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -89,21 +77,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Category).AreEqual;
}
@ -113,7 +92,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Category to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Category input)
public bool Equals(Category? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,12 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using JsonSubTypes;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -30,61 +29,22 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ChildCat
/// </summary>
[DataContract(Name = "ChildCat")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
public partial class ChildCat : ParentPet, IEquatable<ChildCat>, IValidatableObject
public partial class ChildCat : ParentPet, IEquatable<ChildCat>
{
/// <summary>
/// Defines PetType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum PetTypeEnum
{
/// <summary>
/// Enum ChildCat for value: ChildCat
/// </summary>
[EnumMember(Value = "ChildCat")]
ChildCat = 1
}
/// <summary>
/// Gets or Sets PetType
/// </summary>
[DataMember(Name = "pet_type", IsRequired = true, EmitDefaultValue = false)]
public PetTypeEnum PetType { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ChildCat" /> class.
/// </summary>
[JsonConstructorAttribute]
protected ChildCat()
/// <param name="childCatAllOf">childCatAllOf</param>
/// <param name="petType">petType (required)</param>
public ChildCat(ChildCatAllOf childCatAllOf, string petType) : base(petType)
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="ChildCat" /> class.
/// </summary>
/// <param name="petType">petType (required) (default to PetTypeEnum.ChildCat).</param>
/// <param name="name">name.</param>
public ChildCat(PetTypeEnum petType = PetTypeEnum.ChildCat, string? name = default) : base()
{
this.PetType = petType;
this.Name = name;
this.AdditionalProperties = new Dictionary<string, object>();
ChildCatAllOf = childCatAllOf;
}
/// <summary>
/// Gets or Sets Name
/// Gets or Sets ChildCat
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
public string? Name { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public ChildCatAllOf? ChildCatAllOf { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -95,28 +55,16 @@ namespace Org.OpenAPITools.Model
StringBuilder sb = new StringBuilder();
sb.Append("class ChildCat {\n");
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
sb.Append(" PetType: ").Append(PetType).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCat).AreEqual;
}
@ -126,7 +74,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ChildCat to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ChildCat input)
public bool Equals(ChildCat? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@ -140,42 +88,72 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 59) + this.PetType.GetHashCode();
if (this.Name != null)
{
hashCode = (hashCode * 59) + this.Name.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
}
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
yield break;
}
}
/// <summary>
/// A Json converter for type ChildCat
/// </summary>
public class ChildCatJsonConverter : JsonConverter<ChildCat>
{
/// <summary>
/// Returns a boolean if the type is compatible with this converter.
/// </summary>
/// <param name="typeToConvert"></param>
/// <returns></returns>
public override bool CanConvert(Type typeToConvert) => typeof(ChildCat).IsAssignableFrom(typeToConvert);
/// <summary>
/// A Json reader.
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override ChildCat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
int currentDepth = reader.CurrentDepth;
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
Utf8JsonReader childCatAllOfReader = reader;
Client.ClientUtils.TryDeserialize<ChildCatAllOf>(ref childCatAllOfReader, options, out ChildCatAllOf? childCatAllOf);
string? petType = default;
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
break;
if (reader.TokenType == JsonTokenType.PropertyName)
{
string? propertyName = reader.GetString();
reader.Read();
switch (propertyName)
{
case "pet_type":
petType = reader.GetString();
break;
}
}
}
return new ChildCat(childCatAllOf, petType);
}
/// <summary>
/// A Json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="childCat"></param>
/// <param name="options"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions options) => throw new NotImplementedException();
}
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,13 +29,22 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ChildCatAllOf
/// </summary>
[DataContract(Name = "ChildCat_allOf")]
public partial class ChildCatAllOf : IEquatable<ChildCatAllOf>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ChildCatAllOf" /> class.
/// </summary>
/// <param name="name">name</param>
/// <param name="petType">petType (default to PetTypeEnum.ChildCat)</param>
public ChildCatAllOf(string? name = default, PetTypeEnum? petType = PetTypeEnum.ChildCat)
{
Name = name;
PetType = petType;
}
/// <summary>
/// Defines PetType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum PetTypeEnum
{
/// <summary>
@ -46,35 +55,23 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>
[DataMember(Name = "pet_type", EmitDefaultValue = false)]
[JsonPropertyName("pet_type")]
public PetTypeEnum? PetType { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ChildCatAllOf" /> class.
/// </summary>
/// <param name="name">name.</param>
/// <param name="petType">petType (default to PetTypeEnum.ChildCat).</param>
public ChildCatAllOf(string? name = default, PetTypeEnum? petType = PetTypeEnum.ChildCat)
{
this.Name = name;
this.PetType = petType;
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -91,21 +88,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCatAllOf).AreEqual;
}
@ -115,7 +103,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ChildCatAllOf to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ChildCatAllOf input)
public bool Equals(ChildCatAllOf? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,30 +29,28 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Model for testing model with \&quot;_class\&quot; property
/// </summary>
[DataContract(Name = "ClassModel")]
public partial class ClassModel : IEquatable<ClassModel>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ClassModel" /> class.
/// </summary>
/// <param name="_class">_class.</param>
/// <param name="_class">_class</param>
public ClassModel(string? _class = default)
{
this.Class = _class;
this.AdditionalProperties = new Dictionary<string, object>();
Class = _class;
}
/// <summary>
/// Gets or Sets Class
/// </summary>
[DataMember(Name = "_class", EmitDefaultValue = false)]
[JsonPropertyName("_class")]
public string? Class { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -68,21 +66,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ClassModel).AreEqual;
}
@ -92,7 +81,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ClassModel to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ClassModel input)
public bool Equals(ClassModel? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,54 +29,34 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// ComplexQuadrilateral
/// </summary>
[DataContract(Name = "ComplexQuadrilateral")]
public partial class ComplexQuadrilateral : IEquatable<ComplexQuadrilateral>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ComplexQuadrilateral" /> class.
/// </summary>
[JsonConstructorAttribute]
protected ComplexQuadrilateral()
/// <param name="quadrilateralInterface">quadrilateralInterface</param>
/// <param name="shapeInterface">shapeInterface</param>
public ComplexQuadrilateral(QuadrilateralInterface quadrilateralInterface, ShapeInterface shapeInterface)
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="ComplexQuadrilateral" /> class.
/// </summary>
/// <param name="shapeType">shapeType (required).</param>
/// <param name="quadrilateralType">quadrilateralType (required).</param>
public ComplexQuadrilateral(string shapeType, string quadrilateralType)
{
// to ensure "shapeType" is required (not null)
if (shapeType == null) {
throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null");
}
this.ShapeType = shapeType;
// to ensure "quadrilateralType" is required (not null)
if (quadrilateralType == null) {
throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null");
}
this.QuadrilateralType = quadrilateralType;
this.AdditionalProperties = new Dictionary<string, object>();
QuadrilateralInterface = quadrilateralInterface;
ShapeInterface = shapeInterface;
}
/// <summary>
/// Gets or Sets ShapeType
/// Gets or Sets ComplexQuadrilateral
/// </summary>
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
public string ShapeType { get; set; }
public QuadrilateralInterface? QuadrilateralInterface { get; set; }
/// <summary>
/// Gets or Sets QuadrilateralType
/// Gets or Sets ComplexQuadrilateral
/// </summary>
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)]
public string QuadrilateralType { get; set; }
public ShapeInterface? ShapeInterface { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -86,28 +66,17 @@ namespace Org.OpenAPITools.Model
{
StringBuilder sb = new StringBuilder();
sb.Append("class ComplexQuadrilateral {\n");
sb.Append(" ShapeType: ").Append(ShapeType).Append("\n");
sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ComplexQuadrilateral).AreEqual;
}
@ -117,7 +86,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of ComplexQuadrilateral to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ComplexQuadrilateral input)
public bool Equals(ComplexQuadrilateral? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@ -131,14 +100,6 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.ShapeType != null)
{
hashCode = (hashCode * 59) + this.ShapeType.GetHashCode();
}
if (this.QuadrilateralType != null)
{
hashCode = (hashCode * 59) + this.QuadrilateralType.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -158,4 +119,64 @@ namespace Org.OpenAPITools.Model
}
}
/// <summary>
/// A Json converter for type ComplexQuadrilateral
/// </summary>
public class ComplexQuadrilateralJsonConverter : JsonConverter<ComplexQuadrilateral>
{
/// <summary>
/// Returns a boolean if the type is compatible with this converter.
/// </summary>
/// <param name="typeToConvert"></param>
/// <returns></returns>
public override bool CanConvert(Type typeToConvert) => typeof(ComplexQuadrilateral).IsAssignableFrom(typeToConvert);
/// <summary>
/// A Json reader.
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override ComplexQuadrilateral Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
int currentDepth = reader.CurrentDepth;
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
Utf8JsonReader quadrilateralInterfaceReader = reader;
Client.ClientUtils.TryDeserialize<QuadrilateralInterface>(ref quadrilateralInterfaceReader, options, out QuadrilateralInterface? quadrilateralInterface);
Utf8JsonReader shapeInterfaceReader = reader;
Client.ClientUtils.TryDeserialize<ShapeInterface>(ref shapeInterfaceReader, options, out ShapeInterface? shapeInterface);
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
break;
if (reader.TokenType == JsonTokenType.PropertyName)
{
string? propertyName = reader.GetString();
reader.Read();
switch (propertyName)
{
}
}
}
return new ComplexQuadrilateral(quadrilateralInterface, shapeInterface);
}
/// <summary>
/// A Json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="complexQuadrilateral"></param>
/// <param name="options"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions options) => throw new NotImplementedException();
}
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,42 +29,30 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// DanishPig
/// </summary>
[DataContract(Name = "DanishPig")]
public partial class DanishPig : IEquatable<DanishPig>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="DanishPig" /> class.
/// </summary>
[JsonConstructorAttribute]
protected DanishPig()
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="DanishPig" /> class.
/// </summary>
/// <param name="className">className (required).</param>
/// <param name="className">className (required)</param>
public DanishPig(string className)
{
// to ensure "className" is required (not null)
if (className == null) {
throw new ArgumentNullException("className is a required property for DanishPig and cannot be null");
}
this.ClassName = className;
this.AdditionalProperties = new Dictionary<string, object>();
if (className == null)
throw new ArgumentNullException("className is a required property for DanishPig and cannot be null.");
ClassName = className;
}
/// <summary>
/// Gets or Sets ClassName
/// </summary>
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
[JsonPropertyName("className")]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -80,21 +68,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as DanishPig).AreEqual;
}
@ -104,7 +83,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of DanishPig to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(DanishPig input)
public bool Equals(DanishPig? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,11 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -29,30 +29,28 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// DeprecatedObject
/// </summary>
[DataContract(Name = "DeprecatedObject")]
public partial class DeprecatedObject : IEquatable<DeprecatedObject>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="DeprecatedObject" /> class.
/// </summary>
/// <param name="name">name.</param>
/// <param name="name">name</param>
public DeprecatedObject(string? name = default)
{
this.Name = name;
this.AdditionalProperties = new Dictionary<string, object>();
Name = name;
}
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
/// <summary>
/// Returns the string presentation of the object
@ -68,21 +66,12 @@ namespace Org.OpenAPITools.Model
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as DeprecatedObject).AreEqual;
}
@ -92,7 +81,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of DeprecatedObject to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(DeprecatedObject input)
public bool Equals(DeprecatedObject? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}

View File

@ -1,3 +1,4 @@
// <auto-generated>
/*
* OpenAPI Petstore
*
@ -7,6 +8,7 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections;
@ -17,12 +19,9 @@ using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using JsonSubTypes;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
@ -30,41 +29,23 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Dog
/// </summary>
[DataContract(Name = "Dog")]
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
public partial class Dog : Animal, IEquatable<Dog>, IValidatableObject
public partial class Dog : Animal, IEquatable<Dog>
{
/// <summary>
/// Initializes a new instance of the <see cref="Dog" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Dog()
/// <param name="dogAllOf">dogAllOf</param>
/// <param name="className">className (required)</param>
/// <param name="color">color (default to &quot;red&quot;)</param>
public Dog(DogAllOf dogAllOf, string className, string? color = "red") : base(className, color)
{
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the <see cref="Dog" /> class.
/// </summary>
/// <param name="className">className (required) (default to &quot;Dog&quot;).</param>
/// <param name="breed">breed.</param>
/// <param name="color">color (default to &quot;red&quot;).</param>
public Dog(string className = "Dog", string? breed = default, string? color = "red") : base(className, color)
{
this.Breed = breed;
this.AdditionalProperties = new Dictionary<string, object>();
DogAllOf = dogAllOf;
}
/// <summary>
/// Gets or Sets Breed
/// Gets or Sets Dog
/// </summary>
[DataMember(Name = "breed", EmitDefaultValue = false)]
public string? Breed { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }
public DogAllOf? DogAllOf { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -75,27 +56,16 @@ namespace Org.OpenAPITools.Model
StringBuilder sb = new StringBuilder();
sb.Append("class Dog {\n");
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
sb.Append(" Breed: ").Append(Breed).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
public override bool Equals(object? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as Dog).AreEqual;
}
@ -105,7 +75,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="input">Instance of Dog to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Dog input)
public bool Equals(Dog? input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@ -119,41 +89,76 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
if (this.Breed != null)
{
hashCode = (hashCode * 59) + this.Breed.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
}
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
return this.BaseValidate(validationContext);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
yield break;
}
}
/// <summary>
/// A Json converter for type Dog
/// </summary>
public class DogJsonConverter : JsonConverter<Dog>
{
/// <summary>
/// Returns a boolean if the type is compatible with this converter.
/// </summary>
/// <param name="typeToConvert"></param>
/// <returns></returns>
public override bool CanConvert(Type typeToConvert) => typeof(Dog).IsAssignableFrom(typeToConvert);
/// <summary>
/// A Json reader.
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override Dog Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
int currentDepth = reader.CurrentDepth;
if (reader.TokenType != JsonTokenType.StartObject)
throw new JsonException();
Utf8JsonReader dogAllOfReader = reader;
Client.ClientUtils.TryDeserialize<DogAllOf>(ref dogAllOfReader, options, out DogAllOf? dogAllOf);
string? className = default;
string? color = default;
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject && currentDepth == reader.CurrentDepth)
break;
if (reader.TokenType == JsonTokenType.PropertyName)
{
string? propertyName = reader.GetString();
reader.Read();
switch (propertyName)
{
case "className":
className = reader.GetString();
break;
case "color":
color = reader.GetString();
break;
}
}
}
return new Dog(dogAllOf, className, color);
}
/// <summary>
/// A Json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dog"></param>
/// <param name="options"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions options) => throw new NotImplementedException();
}
}

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