mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-28 19:50:49 +00:00
[csharp][generichost] Remove discriminator property (#18445)
* fixed nullability * minor refactor to address a comment * removed discriminator property * update more manual tests * update more manual tests * added tests and bug fixes * fixed allof * reworked manual tests to compare json instead of classes, reworked discriminator logic * removed unneeded code
This commit is contained in:
parent
27120357aa
commit
ede6458d19
@ -589,10 +589,21 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A property is new if it is in a derived class and the derived property is different.
|
||||||
|
* This usually occurs when the data type is different.
|
||||||
|
* We can also consider discriminators as new because the derived class discriminator will have to be defined again
|
||||||
|
* to contain a new value. Doing so prevents having to include the discriminator in the constructor.
|
||||||
|
* @param model
|
||||||
|
* @param property
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private boolean codegenPropertyIsNew(CodegenModel model, CodegenProperty property) {
|
private boolean codegenPropertyIsNew(CodegenModel model, CodegenProperty property) {
|
||||||
return model.parentModel == null
|
return model.parentModel == null
|
||||||
? false
|
? false
|
||||||
: model.parentModel.allVars.stream().anyMatch(p -> p.name.equals(property.name) && (p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false));
|
: model.parentModel.allVars.stream().anyMatch(p ->
|
||||||
|
p.name.equals(property.name) &&
|
||||||
|
(p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false || p.isDiscriminator));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -336,6 +336,43 @@ using System.Runtime.CompilerServices;
|
|||||||
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the discriminator
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="discriminator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public static string{{nrt?}} GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string{{nrt?}} localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator))
|
||||||
|
return utf8JsonReader.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new JsonException("The specified discriminator was not found.");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base path of the API
|
/// The base path of the API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -44,6 +44,17 @@
|
|||||||
|
|
||||||
{{/-last}}
|
{{/-last}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
|
{{#discriminator}}
|
||||||
|
{{#children}}
|
||||||
|
{{#-first}}
|
||||||
|
string{{nrt?}} discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "{{discriminator.propertyBaseName}}");
|
||||||
|
|
||||||
|
{{/-first}}
|
||||||
|
if (discriminator != null && discriminator.Equals("{{name}}"))
|
||||||
|
return JsonSerializer.Deserialize<{{{name}}}>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
{{/children}}
|
||||||
|
{{/discriminator}}
|
||||||
{{#model.discriminator}}
|
{{#model.discriminator}}
|
||||||
{{#model.hasDiscriminatorWithNonEmptyMapping}}
|
{{#model.hasDiscriminatorWithNonEmptyMapping}}
|
||||||
{{#mappedModels}}
|
{{#mappedModels}}
|
||||||
@ -281,7 +292,7 @@
|
|||||||
{{#model.hasDiscriminatorWithNonEmptyMapping}}
|
{{#model.hasDiscriminatorWithNonEmptyMapping}}
|
||||||
{{#mappedModels}}
|
{{#mappedModels}}
|
||||||
if ({{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}} != null)
|
if ({{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}} != null)
|
||||||
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}});
|
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{^isDiscriminator}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/isDiscriminator}}{{/allVars}}{{/lambda.joinWithComma}});
|
||||||
|
|
||||||
{{#-last}}
|
{{#-last}}
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
@ -300,14 +311,14 @@
|
|||||||
|
|
||||||
{{/-last}}
|
{{/-last}}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ParsedValue{{#required}}.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}});
|
return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ParsedValue{{#required}}.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{^isDiscriminator}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/isDiscriminator}}{{/allVars}}{{/lambda.joinWithComma}});
|
||||||
{{/composedSchemas.oneOf}}
|
{{/composedSchemas.oneOf}}
|
||||||
{{^model.discriminator}}
|
{{^model.discriminator}}
|
||||||
{{#composedSchemas}}
|
{{#composedSchemas}}
|
||||||
{{#oneOf}}
|
{{#oneOf}}
|
||||||
{{^vendorExtensions.x-duplicated-data-type}}
|
{{^vendorExtensions.x-duplicated-data-type}}
|
||||||
if ({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} != null)
|
if ({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} != null)
|
||||||
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}ParsedValue{{/required}} {{/allVars}}{{/lambda.joinWithComma}});
|
return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{^isDiscriminator}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{#required}}ParsedValue{{/required}} {{/isDiscriminator}}{{/allVars}}{{/lambda.joinWithComma}});
|
||||||
|
|
||||||
{{/vendorExtensions.x-duplicated-data-type}}
|
{{/vendorExtensions.x-duplicated-data-type}}
|
||||||
{{#-last}}
|
{{#-last}}
|
||||||
@ -331,6 +342,18 @@
|
|||||||
public override void Write(Utf8JsonWriter writer, {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, JsonSerializerOptions jsonSerializerOptions)
|
public override void Write(Utf8JsonWriter writer, {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
{{#lambda.trimLineBreaks}}
|
{{#lambda.trimLineBreaks}}
|
||||||
|
{{#lambda.copy}}
|
||||||
|
{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}
|
||||||
|
{{/lambda.copy}}
|
||||||
|
{{#discriminator}}
|
||||||
|
{{#children}}
|
||||||
|
if ({{#lambda.pasteLine}}{{/lambda.pasteLine}} is {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}){
|
||||||
|
JsonSerializer.Serialize<{{{name}}}>(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/children}}
|
||||||
|
{{/discriminator}}
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
{{#model.discriminator}}
|
{{#model.discriminator}}
|
||||||
@ -339,7 +362,7 @@
|
|||||||
{{^vendorExtensions.x-duplicated-data-type}}
|
{{^vendorExtensions.x-duplicated-data-type}}
|
||||||
if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} != null) {
|
if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} != null) {
|
||||||
{{baseType}}JsonConverter {{#lambda.camelcase_sanitize_param}}{{baseType}}JsonConverter{{/lambda.camelcase_sanitize_param}} = ({{baseType}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}.GetType()));
|
{{baseType}}JsonConverter {{#lambda.camelcase_sanitize_param}}{{baseType}}JsonConverter{{/lambda.camelcase_sanitize_param}} = ({{baseType}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}.GetType()));
|
||||||
{{#lambda.camelcase_sanitize_param}}{{baseType}}JsonConverter{{/lambda.camelcase_sanitize_param}}.WriteProperties(ref writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
|
{{#lambda.camelcase_sanitize_param}}{{baseType}}JsonConverter{{/lambda.camelcase_sanitize_param}}.WriteProperties(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/vendorExtensions.x-duplicated-data-type}}
|
{{/vendorExtensions.x-duplicated-data-type}}
|
||||||
@ -352,13 +375,13 @@
|
|||||||
if ({{#lambda.joinWithAmpersand}}{{^required}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet {{/required}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}} != null{{/lambda.joinWithAmpersand}})
|
if ({{#lambda.joinWithAmpersand}}{{^required}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet {{/required}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}} != null{{/lambda.joinWithAmpersand}})
|
||||||
{
|
{
|
||||||
{{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}}.GetType()));
|
{{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}}.GetType()));
|
||||||
{{datatypeWithEnum}}JsonConverter.WriteProperties(ref writer, {{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}}, jsonSerializerOptions);
|
{{datatypeWithEnum}}JsonConverter.WriteProperties(writer, {{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}}, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/anyOf}}
|
{{/anyOf}}
|
||||||
{{/composedSchemas}}
|
{{/composedSchemas}}
|
||||||
{{/model.discriminator}}
|
{{/model.discriminator}}
|
||||||
WriteProperties(ref writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
|
WriteProperties(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
{{/lambda.trimLineBreaks}}
|
{{/lambda.trimLineBreaks}}
|
||||||
}
|
}
|
||||||
@ -370,11 +393,12 @@
|
|||||||
/// <param name="{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}"></param>
|
/// <param name="{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
{{#lambda.trimTrailingWithNewLine}}
|
{{#lambda.trimTrailingWithNewLine}}
|
||||||
{{#lambda.trimLineBreaks}}
|
{{#lambda.trimLineBreaks}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{^isNullable}}
|
{{^isNullable}}
|
||||||
{{#vendorExtensions.x-is-reference-type}}
|
{{#vendorExtensions.x-is-reference-type}}
|
||||||
if ({{^required}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet && {{/required}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} == null)
|
if ({{^required}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet && {{/required}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} == null)
|
||||||
@ -382,8 +406,18 @@
|
|||||||
|
|
||||||
{{/vendorExtensions.x-is-reference-type}}
|
{{/vendorExtensions.x-is-reference-type}}
|
||||||
{{/isNullable}}
|
{{/isNullable}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{#isDiscriminator}}
|
||||||
|
{{^model.composedSchemas.anyOf}}
|
||||||
|
{{^model.composedSchemas.oneOf}}
|
||||||
|
writer.WriteString("{{baseName}}", {{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{/isEnum}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{datatypeWithEnum}}}ToJsonValue{{/isInnerEnum}}{{^isInnerEnum}}{{{datatypeWithEnum}}}ValueConverter.ToJsonValue{{/isInnerEnum}}({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}.Value{{/required}}){{/isEnum}}{{/isNew}});
|
||||||
|
|
||||||
|
{{/model.composedSchemas.oneOf}}
|
||||||
|
{{/model.composedSchemas.anyOf}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{#isString}}
|
{{#isString}}
|
||||||
{{^isMap}}
|
{{^isMap}}
|
||||||
{{^isEnum}}
|
{{^isEnum}}
|
||||||
@ -579,6 +613,7 @@
|
|||||||
{{/isString}}
|
{{/isString}}
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
{{/isUuid}}
|
{{/isUuid}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
{{/lambda.trimLineBreaks}}
|
{{/lambda.trimLineBreaks}}
|
||||||
{{/lambda.trimTrailingWithNewLine}}
|
{{/lambda.trimTrailingWithNewLine}}
|
||||||
|
@ -1 +1 @@
|
|||||||
{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{parent}}{{/lambda.camelcase_sanitize_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{datatypeWithEnum}}}ToJsonValue{{/isInnerEnum}}{{^isInnerEnum}}{{{datatypeWithEnum}}}ValueConverter.ToJsonValue{{/isInnerEnum}}({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{^required}}.Value{{/required}}){{/isEnum}}{{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}.ToString(){{/isEnum}}{{/isNew}} {{/isInherited}}{{/allVars}}
|
{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{parent}}{{/lambda.camelcase_sanitize_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{^isDiscriminator}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{datatypeWithEnum}}}ToJsonValue{{/isInnerEnum}}{{^isInnerEnum}}{{{datatypeWithEnum}}}ValueConverter.ToJsonValue{{/isInnerEnum}}({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{^required}}.Value{{/required}}){{/isEnum}}{{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}.ToString(){{/isEnum}}{{/isNew}} {{/isInherited}}{{/isDiscriminator}}{{/allVars}}
|
@ -1 +1 @@
|
|||||||
{{#model.allVars}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}}{{#defaultValue}} = {{^required}}default{{/required}}{{#required}}{{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{.}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/required}}{{/defaultValue}}{{^defaultValue}}{{#lambda.first}}{{#isNullable}} = default {{/isNullable}}{{^required}} = default {{/required}}{{/lambda.first}}{{/defaultValue}} {{/model.allVars}}
|
{{#model.allVars}}{{^isDiscriminator}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}}{{#defaultValue}} = {{^required}}default{{/required}}{{#required}}{{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{.}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/required}}{{/defaultValue}}{{^defaultValue}}{{#lambda.first}}{{#isNullable}} = default {{/isNullable}}{{^required}} = default {{/required}}{{/lambda.first}}{{/defaultValue}} {{/isDiscriminator}}{{/model.allVars}}
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}"></param>
|
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}"></param>
|
||||||
{{/composedSchemas.anyOf}}
|
{{/composedSchemas.anyOf}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}">{{description}}{{^description}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
|
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}">{{description}}{{^description}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
{{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{{dataType}}} {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}} {{#model.composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{baseType}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}} {{/model.composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{parent}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}}.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}}
|
{{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{{dataType}}} {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}} {{#model.composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{baseType}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}} {{/model.composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{parent}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}}.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}}
|
||||||
{
|
{
|
||||||
@ -22,6 +24,7 @@
|
|||||||
{{/composedSchemas.anyOf}}
|
{{/composedSchemas.anyOf}}
|
||||||
{{name}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
{{name}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{^isInherited}}
|
{{^isInherited}}
|
||||||
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
@ -30,6 +33,7 @@
|
|||||||
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
||||||
{{/isNew}}
|
{{/isNew}}
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -44,7 +48,9 @@
|
|||||||
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}"></param>
|
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}"></param>
|
||||||
{{/composedSchemas.anyOf}}
|
{{/composedSchemas.anyOf}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}">{{description}}{{^description}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
|
/// <param name="{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}">{{description}}{{^description}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}</param>
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
{{^composedSchemas.anyOf}}
|
{{^composedSchemas.anyOf}}
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
@ -55,6 +61,7 @@
|
|||||||
{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
||||||
{{/composedSchemas.anyOf}}
|
{{/composedSchemas.anyOf}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{^isInherited}}
|
{{^isInherited}}
|
||||||
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
@ -63,6 +70,7 @@
|
|||||||
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
{{name}}{{^required}}Option{{/required}} = {{#lambda.escape_reserved_word}}{{#lambda.camel_case}}{{name}}{{/lambda.camel_case}}{{/lambda.escape_reserved_word}};
|
||||||
{{/isNew}}
|
{{/isNew}}
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -83,6 +91,7 @@
|
|||||||
{{>modelInnerEnum}}
|
{{>modelInnerEnum}}
|
||||||
{{/complexType}}
|
{{/complexType}}
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
{{^required}}
|
{{^required}}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -109,6 +118,7 @@
|
|||||||
public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
|
public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}
|
||||||
|
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
{{#composedSchemas.anyOf}}
|
{{#composedSchemas.anyOf}}
|
||||||
{{^vendorExtensions.x-duplicated-data-type}}
|
{{^vendorExtensions.x-duplicated-data-type}}
|
||||||
@ -152,6 +162,20 @@
|
|||||||
{{/vendorExtensions.x-duplicated-data-type}}
|
{{/vendorExtensions.x-duplicated-data-type}}
|
||||||
{{/composedSchemas.oneOf}}
|
{{/composedSchemas.oneOf}}
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
{{#isDiscriminator}}
|
||||||
|
{{^model.composedSchemas.anyOf}}
|
||||||
|
{{^model.composedSchemas.oneOf}}
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public {{#isNew}}new {{/isNew}}{{datatypeWithEnum}} {{name}} { get; } = {{^isNew}}"{{classname}}"{{/isNew}}{{#isNew}}{{^isEnum}}"{{classname}}"{{/isEnum}}{{#isEnum}}({{datatypeWithEnum}})Enum.Parse(typeof({{datatypeWithEnum}}), "{{classname}}"){{/isEnum}}{{/isNew}};
|
||||||
|
|
||||||
|
{{/model.composedSchemas.oneOf}}
|
||||||
|
{{/model.composedSchemas.anyOf}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{^isEnum}}
|
{{^isEnum}}
|
||||||
{{#isInherited}}
|
{{#isInherited}}
|
||||||
{{#isNew}}
|
{{#isNew}}
|
||||||
@ -204,6 +228,7 @@
|
|||||||
|
|
||||||
{{/isInherited}}
|
{{/isInherited}}
|
||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
{{#isAdditionalPropertiesTrue}}
|
{{#isAdditionalPropertiesTrue}}
|
||||||
{{^parentModel}}
|
{{^parentModel}}
|
||||||
@ -227,7 +252,9 @@
|
|||||||
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||||
{{/parent}}
|
{{/parent}}
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
{{#isAdditionalPropertiesTrue}}
|
{{#isAdditionalPropertiesTrue}}
|
||||||
{{^parentModel}}
|
{{^parentModel}}
|
||||||
|
@ -266,6 +266,43 @@ namespace Org.OpenAPITools.Client
|
|||||||
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the discriminator
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="discriminator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string? localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator))
|
||||||
|
return utf8JsonReader.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new JsonException("The specified discriminator was not found.");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base path of the API
|
/// The base path of the API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -37,9 +37,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="children">children</param>
|
/// <param name="children">children</param>
|
||||||
/// <param name="firstName">firstName</param>
|
/// <param name="firstName">firstName</param>
|
||||||
/// <param name="lastName">lastName</param>
|
/// <param name="lastName">lastName</param>
|
||||||
/// <param name="type">type</param>
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Adult(Option<List<Child>?> children = default, Option<string?> firstName = default, Option<string?> lastName = default, Option<string?> type = default) : base(firstName, lastName, type)
|
public Adult(Option<List<Child>?> children = default, Option<string?> firstName = default, Option<string?> lastName = default) : base(firstName, lastName)
|
||||||
{
|
{
|
||||||
ChildrenOption = children;
|
ChildrenOption = children;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
@ -60,6 +59,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonPropertyName("children")]
|
[JsonPropertyName("children")]
|
||||||
public List<Child>? Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new(value); } }
|
public List<Child>? Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new(value); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public new string Type { get; } = "Adult";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -148,7 +154,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (type.IsSet && type.Value == null)
|
if (type.IsSet && type.Value == null)
|
||||||
throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult.");
|
throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult.");
|
||||||
|
|
||||||
return new Adult(children, firstName, lastName, type);
|
return new Adult(children, firstName, lastName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -162,7 +168,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, adult, jsonSerializerOptions);
|
WriteProperties(writer, adult, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +179,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="adult"></param>
|
/// <param name="adult"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (adult.ChildrenOption.IsSet && adult.Children == null)
|
if (adult.ChildrenOption.IsSet && adult.Children == null)
|
||||||
throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult.");
|
throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult.");
|
||||||
@ -184,9 +190,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (adult.LastNameOption.IsSet && adult.LastName == null)
|
if (adult.LastNameOption.IsSet && adult.LastName == null)
|
||||||
throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult.");
|
throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult.");
|
||||||
|
|
||||||
if (adult.TypeOption.IsSet && adult.Type == null)
|
|
||||||
throw new ArgumentNullException(nameof(adult.Type), "Property is required for class Adult.");
|
|
||||||
|
|
||||||
if (adult.ChildrenOption.IsSet)
|
if (adult.ChildrenOption.IsSet)
|
||||||
{
|
{
|
||||||
writer.WritePropertyName("children");
|
writer.WritePropertyName("children");
|
||||||
@ -198,8 +201,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (adult.LastNameOption.IsSet)
|
if (adult.LastNameOption.IsSet)
|
||||||
writer.WriteString("lastName", adult.LastName);
|
writer.WriteString("lastName", adult.LastName);
|
||||||
|
|
||||||
if (adult.TypeOption.IsSet)
|
writer.WriteString("$_type", adult.Type);
|
||||||
writer.WriteString("$_type", adult.Type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="age">age</param>
|
/// <param name="age">age</param>
|
||||||
/// <param name="firstName">firstName</param>
|
/// <param name="firstName">firstName</param>
|
||||||
/// <param name="lastName">lastName</param>
|
/// <param name="lastName">lastName</param>
|
||||||
/// <param name="type">type</param>
|
|
||||||
/// <param name="boosterSeat">boosterSeat</param>
|
/// <param name="boosterSeat">boosterSeat</param>
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Child(Option<int?> age = default, Option<string?> firstName = default, Option<string?> lastName = default, Option<string?> type = default, Option<bool?> boosterSeat = default) : base(firstName, lastName, type)
|
public Child(Option<int?> age = default, Option<string?> firstName = default, Option<string?> lastName = default, Option<bool?> boosterSeat = default) : base(firstName, lastName)
|
||||||
{
|
{
|
||||||
AgeOption = age;
|
AgeOption = age;
|
||||||
BoosterSeatOption = boosterSeat;
|
BoosterSeatOption = boosterSeat;
|
||||||
@ -62,6 +61,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
[JsonPropertyName("age")]
|
[JsonPropertyName("age")]
|
||||||
public int? Age { get { return this.AgeOption; } set { this.AgeOption = new(value); } }
|
public int? Age { get { return this.AgeOption; } set { this.AgeOption = new(value); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public new string Type { get; } = "Child";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of BoosterSeat
|
/// Used to track the state of BoosterSeat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -172,7 +178,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (boosterSeat.IsSet && boosterSeat.Value == null)
|
if (boosterSeat.IsSet && boosterSeat.Value == null)
|
||||||
throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child.");
|
throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child.");
|
||||||
|
|
||||||
return new Child(age, firstName, lastName, type, boosterSeat);
|
return new Child(age, firstName, lastName, boosterSeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -186,7 +192,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, child, jsonSerializerOptions);
|
WriteProperties(writer, child, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +203,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="child"></param>
|
/// <param name="child"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (child.FirstNameOption.IsSet && child.FirstName == null)
|
if (child.FirstNameOption.IsSet && child.FirstName == null)
|
||||||
throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child.");
|
throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child.");
|
||||||
@ -205,9 +211,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (child.LastNameOption.IsSet && child.LastName == null)
|
if (child.LastNameOption.IsSet && child.LastName == null)
|
||||||
throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child.");
|
throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child.");
|
||||||
|
|
||||||
if (child.TypeOption.IsSet && child.Type == null)
|
|
||||||
throw new ArgumentNullException(nameof(child.Type), "Property is required for class Child.");
|
|
||||||
|
|
||||||
if (child.AgeOption.IsSet)
|
if (child.AgeOption.IsSet)
|
||||||
writer.WriteNumber("age", child.AgeOption.Value!.Value);
|
writer.WriteNumber("age", child.AgeOption.Value!.Value);
|
||||||
|
|
||||||
@ -217,8 +220,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (child.LastNameOption.IsSet)
|
if (child.LastNameOption.IsSet)
|
||||||
writer.WriteString("lastName", child.LastName);
|
writer.WriteString("lastName", child.LastName);
|
||||||
|
|
||||||
if (child.TypeOption.IsSet)
|
writer.WriteString("$_type", child.Type);
|
||||||
writer.WriteString("$_type", child.Type);
|
|
||||||
|
|
||||||
if (child.BoosterSeatOption.IsSet)
|
if (child.BoosterSeatOption.IsSet)
|
||||||
writer.WriteBoolean("boosterSeat", child.BoosterSeatOption.Value!.Value);
|
writer.WriteBoolean("boosterSeat", child.BoosterSeatOption.Value!.Value);
|
||||||
|
@ -36,13 +36,11 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="firstName">firstName</param>
|
/// <param name="firstName">firstName</param>
|
||||||
/// <param name="lastName">lastName</param>
|
/// <param name="lastName">lastName</param>
|
||||||
/// <param name="type">type</param>
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Person(Option<string?> firstName = default, Option<string?> lastName = default, Option<string?> type = default)
|
public Person(Option<string?> firstName = default, Option<string?> lastName = default)
|
||||||
{
|
{
|
||||||
FirstNameOption = firstName;
|
FirstNameOption = firstName;
|
||||||
LastNameOption = lastName;
|
LastNameOption = lastName;
|
||||||
TypeOption = type;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,17 +73,11 @@ namespace Org.OpenAPITools.Model
|
|||||||
public string? LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } }
|
public string? LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Type
|
/// The discriminator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
public Option<string?> TypeOption { get; private set; }
|
public string Type { get; } = "Person";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Type
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("$_type")]
|
|
||||||
public string? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
@ -103,7 +95,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
sb.Append("class Person {\n");
|
sb.Append("class Person {\n");
|
||||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||||
sb.Append(" Type: ").Append(Type).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -156,6 +147,14 @@ namespace Org.OpenAPITools.Model
|
|||||||
Option<string?> lastName = default;
|
Option<string?> lastName = default;
|
||||||
Option<string?> type = default;
|
Option<string?> type = default;
|
||||||
|
|
||||||
|
string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$_type");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Adult"))
|
||||||
|
return JsonSerializer.Deserialize<Adult>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Child"))
|
||||||
|
return JsonSerializer.Deserialize<Child>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
while (utf8JsonReader.Read())
|
while (utf8JsonReader.Read())
|
||||||
{
|
{
|
||||||
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
@ -195,7 +194,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (type.IsSet && type.Value == null)
|
if (type.IsSet && type.Value == null)
|
||||||
throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person.");
|
throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person.");
|
||||||
|
|
||||||
return new Person(firstName, lastName, type);
|
return new Person(firstName, lastName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -207,9 +206,19 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions)
|
public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
if (person is Adult adult){
|
||||||
|
JsonSerializer.Serialize<Adult>(writer, adult, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (person is Child child){
|
||||||
|
JsonSerializer.Serialize<Child>(writer, child, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, person, jsonSerializerOptions);
|
WriteProperties(writer, person, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +229,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="person"></param>
|
/// <param name="person"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (person.FirstNameOption.IsSet && person.FirstName == null)
|
if (person.FirstNameOption.IsSet && person.FirstName == null)
|
||||||
throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person.");
|
throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person.");
|
||||||
@ -228,17 +237,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (person.LastNameOption.IsSet && person.LastName == null)
|
if (person.LastNameOption.IsSet && person.LastName == null)
|
||||||
throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person.");
|
throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person.");
|
||||||
|
|
||||||
if (person.TypeOption.IsSet && person.Type == null)
|
|
||||||
throw new ArgumentNullException(nameof(person.Type), "Property is required for class Person.");
|
|
||||||
|
|
||||||
if (person.FirstNameOption.IsSet)
|
if (person.FirstNameOption.IsSet)
|
||||||
writer.WriteString("firstName", person.FirstName);
|
writer.WriteString("firstName", person.FirstName);
|
||||||
|
|
||||||
if (person.LastNameOption.IsSet)
|
if (person.LastNameOption.IsSet)
|
||||||
writer.WriteString("lastName", person.LastName);
|
writer.WriteString("lastName", person.LastName);
|
||||||
|
|
||||||
if (person.TypeOption.IsSet)
|
writer.WriteString("$_type", person.Type);
|
||||||
writer.WriteString("$_type", person.Type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,6 +266,43 @@ namespace Org.OpenAPITools.Client
|
|||||||
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the discriminator
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="discriminator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string? localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator))
|
||||||
|
return utf8JsonReader.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new JsonException("The specified discriminator was not found.");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base path of the API
|
/// The base path of the API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -153,7 +153,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, apple, jsonSerializerOptions);
|
WriteProperties(writer, apple, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="apple"></param>
|
/// <param name="apple"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (apple.KindOption.IsSet && apple.Kind == null)
|
if (apple.KindOption.IsSet && apple.Kind == null)
|
||||||
throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple.");
|
throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple.");
|
||||||
|
@ -154,7 +154,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, banana, jsonSerializerOptions);
|
WriteProperties(writer, banana, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="banana"></param>
|
/// <param name="banana"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (banana.CountOption.IsSet)
|
if (banana.CountOption.IsSet)
|
||||||
writer.WriteNumber("count", banana.CountOption.Value!.Value);
|
writer.WriteNumber("count", banana.CountOption.Value!.Value);
|
||||||
|
@ -212,16 +212,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null)
|
if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null)
|
||||||
{
|
{
|
||||||
AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType()));
|
AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType()));
|
||||||
AppleJsonConverter.WriteProperties(ref writer, fruit.AppleOption.Value, jsonSerializerOptions);
|
AppleJsonConverter.WriteProperties(writer, fruit.AppleOption.Value, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null)
|
if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null)
|
||||||
{
|
{
|
||||||
BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType()));
|
BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType()));
|
||||||
BananaJsonConverter.WriteProperties(ref writer, fruit.BananaOption.Value, jsonSerializerOptions);
|
BananaJsonConverter.WriteProperties(writer, fruit.BananaOption.Value, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, fruit, jsonSerializerOptions);
|
WriteProperties(writer, fruit, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="fruit"></param>
|
/// <param name="fruit"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (fruit.ColorOption.IsSet && fruit.Color == null)
|
if (fruit.ColorOption.IsSet && fruit.Color == null)
|
||||||
throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit.");
|
throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit.");
|
||||||
|
@ -251,6 +251,43 @@ namespace Org.OpenAPITools.Client
|
|||||||
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the discriminator
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="discriminator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string? localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator))
|
||||||
|
return utf8JsonReader.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new JsonException("The specified discriminator was not found.");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base path of the API
|
/// The base path of the API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, apple, jsonSerializerOptions);
|
WriteProperties(writer, apple, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="apple"></param>
|
/// <param name="apple"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (apple.KindOption.IsSet && apple.Kind == null)
|
if (apple.KindOption.IsSet && apple.Kind == null)
|
||||||
throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple.");
|
throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple.");
|
||||||
|
@ -153,7 +153,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, banana, jsonSerializerOptions);
|
WriteProperties(writer, banana, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="banana"></param>
|
/// <param name="banana"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (banana.CountOption.IsSet)
|
if (banana.CountOption.IsSet)
|
||||||
writer.WriteNumber("count", banana.CountOption.Value!.Value);
|
writer.WriteNumber("count", banana.CountOption.Value!.Value);
|
||||||
|
@ -211,16 +211,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null)
|
if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null)
|
||||||
{
|
{
|
||||||
AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType()));
|
AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType()));
|
||||||
AppleJsonConverter.WriteProperties(ref writer, fruit.AppleOption.Value, jsonSerializerOptions);
|
AppleJsonConverter.WriteProperties(writer, fruit.AppleOption.Value, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null)
|
if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null)
|
||||||
{
|
{
|
||||||
BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType()));
|
BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType()));
|
||||||
BananaJsonConverter.WriteProperties(ref writer, fruit.BananaOption.Value, jsonSerializerOptions);
|
BananaJsonConverter.WriteProperties(writer, fruit.BananaOption.Value, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, fruit, jsonSerializerOptions);
|
WriteProperties(writer, fruit, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="fruit"></param>
|
/// <param name="fruit"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (fruit.ColorOption.IsSet && fruit.Color == null)
|
if (fruit.ColorOption.IsSet && fruit.Color == null)
|
||||||
throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit.");
|
throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit.");
|
||||||
|
@ -355,6 +355,43 @@ namespace Org.OpenAPITools.Client
|
|||||||
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the discriminator
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="utf8JsonReader"></param>
|
||||||
|
/// <param name="discriminator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public static string GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator)
|
||||||
|
{
|
||||||
|
int currentDepth = utf8JsonReader.CurrentDepth;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
|
||||||
|
throw new JsonException();
|
||||||
|
|
||||||
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
|
while (utf8JsonReader.Read())
|
||||||
|
{
|
||||||
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
|
||||||
|
{
|
||||||
|
string localVarJsonPropertyName = utf8JsonReader.GetString();
|
||||||
|
utf8JsonReader.Read();
|
||||||
|
|
||||||
|
if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator))
|
||||||
|
return utf8JsonReader.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new JsonException("The specified discriminator was not found.");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base path of the API
|
/// The base path of the API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, activity, jsonSerializerOptions);
|
WriteProperties(writer, activity, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="activity"></param>
|
/// <param name="activity"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null)
|
if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null)
|
||||||
throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity.");
|
throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity.");
|
||||||
|
@ -175,7 +175,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, activityOutputElementRepresentation, jsonSerializerOptions);
|
WriteProperties(writer, activityOutputElementRepresentation, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="activityOutputElementRepresentation"></param>
|
/// <param name="activityOutputElementRepresentation"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null)
|
if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null)
|
||||||
throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation.");
|
throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation.");
|
||||||
|
@ -318,7 +318,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, additionalPropertiesClass, jsonSerializerOptions);
|
WriteProperties(writer, additionalPropertiesClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="additionalPropertiesClass"></param>
|
/// <param name="additionalPropertiesClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null)
|
if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null)
|
||||||
throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass.");
|
throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass.");
|
||||||
|
@ -32,12 +32,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Animal" /> class.
|
/// Initializes a new instance of the <see cref="Animal" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="className">className</param>
|
|
||||||
/// <param name="color">color (default to "red")</param>
|
/// <param name="color">color (default to "red")</param>
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Animal(string className, Option<string> color = default)
|
public Animal(Option<string> color = default)
|
||||||
{
|
{
|
||||||
ClassName = className;
|
|
||||||
ColorOption = color;
|
ColorOption = color;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -45,10 +43,11 @@ namespace Org.OpenAPITools.Model
|
|||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ClassName
|
/// The discriminator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("className")]
|
[JsonIgnore]
|
||||||
public string ClassName { get; set; }
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public string ClassName { get; } = "Animal";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Color
|
/// Used to track the state of Color
|
||||||
@ -77,7 +76,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class Animal {\n");
|
sb.Append("class Animal {\n");
|
||||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
|
||||||
sb.Append(" Color: ").Append(Color).Append("\n");
|
sb.Append(" Color: ").Append(Color).Append("\n");
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -130,6 +128,14 @@ namespace Org.OpenAPITools.Model
|
|||||||
Option<string> className = default;
|
Option<string> className = default;
|
||||||
Option<string> color = default;
|
Option<string> color = default;
|
||||||
|
|
||||||
|
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "className");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Cat"))
|
||||||
|
return JsonSerializer.Deserialize<Cat>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("Dog"))
|
||||||
|
return JsonSerializer.Deserialize<Dog>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
while (utf8JsonReader.Read())
|
while (utf8JsonReader.Read())
|
||||||
{
|
{
|
||||||
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
@ -166,7 +172,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (color.IsSet && color.Value == null)
|
if (color.IsSet && color.Value == null)
|
||||||
throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal.");
|
throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal.");
|
||||||
|
|
||||||
return new Animal(className.Value, color);
|
return new Animal(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -178,9 +184,19 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions)
|
public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
if (animal is Cat cat){
|
||||||
|
JsonSerializer.Serialize<Cat>(writer, cat, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animal is Dog dog){
|
||||||
|
JsonSerializer.Serialize<Dog>(writer, dog, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, animal, jsonSerializerOptions);
|
WriteProperties(writer, animal, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,11 +207,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="animal"></param>
|
/// <param name="animal"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (animal.ClassName == null)
|
|
||||||
throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal.");
|
|
||||||
|
|
||||||
if (animal.ColorOption.IsSet && animal.Color == null)
|
if (animal.ColorOption.IsSet && animal.Color == null)
|
||||||
throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal.");
|
throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal.");
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, apiResponse, jsonSerializerOptions);
|
WriteProperties(writer, apiResponse, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="apiResponse"></param>
|
/// <param name="apiResponse"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (apiResponse.MessageOption.IsSet && apiResponse.Message == null)
|
if (apiResponse.MessageOption.IsSet && apiResponse.Message == null)
|
||||||
throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse.");
|
throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse.");
|
||||||
|
@ -227,7 +227,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, apple, jsonSerializerOptions);
|
WriteProperties(writer, apple, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="apple"></param>
|
/// <param name="apple"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (apple.ColorCodeOption.IsSet && apple.ColorCode == null)
|
if (apple.ColorCodeOption.IsSet && apple.ColorCode == null)
|
||||||
throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple.");
|
throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple.");
|
||||||
|
@ -164,7 +164,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, appleReq, jsonSerializerOptions);
|
WriteProperties(writer, appleReq, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="appleReq"></param>
|
/// <param name="appleReq"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (appleReq.Cultivar == null)
|
if (appleReq.Cultivar == null)
|
||||||
throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq.");
|
throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq.");
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, arrayOfArrayOfNumberOnly, jsonSerializerOptions);
|
WriteProperties(writer, arrayOfArrayOfNumberOnly, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="arrayOfArrayOfNumberOnly"></param>
|
/// <param name="arrayOfArrayOfNumberOnly"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null)
|
if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null)
|
||||||
throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly.");
|
throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly.");
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, arrayOfNumberOnly, jsonSerializerOptions);
|
WriteProperties(writer, arrayOfNumberOnly, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="arrayOfNumberOnly"></param>
|
/// <param name="arrayOfNumberOnly"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null)
|
if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null)
|
||||||
throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly.");
|
throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly.");
|
||||||
|
@ -200,7 +200,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, arrayTest, jsonSerializerOptions);
|
WriteProperties(writer, arrayTest, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="arrayTest"></param>
|
/// <param name="arrayTest"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null)
|
if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null)
|
||||||
throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest.");
|
throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest.");
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, banana, jsonSerializerOptions);
|
WriteProperties(writer, banana, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="banana"></param>
|
/// <param name="banana"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (banana.LengthCmOption.IsSet)
|
if (banana.LengthCmOption.IsSet)
|
||||||
writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value);
|
writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value);
|
||||||
|
@ -165,7 +165,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, bananaReq, jsonSerializerOptions);
|
WriteProperties(writer, bananaReq, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="bananaReq"></param>
|
/// <param name="bananaReq"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
writer.WriteNumber("lengthCm", bananaReq.LengthCm);
|
writer.WriteNumber("lengthCm", bananaReq.LengthCm);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, basquePig, jsonSerializerOptions);
|
WriteProperties(writer, basquePig, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="basquePig"></param>
|
/// <param name="basquePig"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (basquePig.ClassName == null)
|
if (basquePig.ClassName == null)
|
||||||
throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig.");
|
throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig.");
|
||||||
|
@ -267,7 +267,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, capitalization, jsonSerializerOptions);
|
WriteProperties(writer, capitalization, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="capitalization"></param>
|
/// <param name="capitalization"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null)
|
if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null)
|
||||||
throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization.");
|
throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization.");
|
||||||
|
@ -32,11 +32,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Cat" /> class.
|
/// Initializes a new instance of the <see cref="Cat" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="className">className</param>
|
|
||||||
/// <param name="color">color (default to "red")</param>
|
/// <param name="color">color (default to "red")</param>
|
||||||
/// <param name="declawed">declawed</param>
|
/// <param name="declawed">declawed</param>
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Cat(string className, Option<string> color = default, Option<bool?> declawed = default) : base(className, color)
|
public Cat(Option<string> color = default, Option<bool?> declawed = default) : base(color)
|
||||||
{
|
{
|
||||||
DeclawedOption = declawed;
|
DeclawedOption = declawed;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
@ -44,6 +43,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public new string ClassName { get; } = "Cat";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Declawed
|
/// Used to track the state of Declawed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -141,7 +147,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (declawed.IsSet && declawed.Value == null)
|
if (declawed.IsSet && declawed.Value == null)
|
||||||
throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat.");
|
throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat.");
|
||||||
|
|
||||||
return new Cat(className.Value, color, declawed);
|
return new Cat(color, declawed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -155,7 +161,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, cat, jsonSerializerOptions);
|
WriteProperties(writer, cat, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,11 +172,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="cat"></param>
|
/// <param name="cat"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (cat.ClassName == null)
|
|
||||||
throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat.");
|
|
||||||
|
|
||||||
if (cat.ColorOption.IsSet && cat.Color == null)
|
if (cat.ColorOption.IsSet && cat.Color == null)
|
||||||
throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat.");
|
throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat.");
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, category, jsonSerializerOptions);
|
WriteProperties(writer, category, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="category"></param>
|
/// <param name="category"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (category.Name == null)
|
if (category.Name == null)
|
||||||
throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category.");
|
throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category.");
|
||||||
|
@ -32,12 +32,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="petType">petType</param>
|
|
||||||
/// <param name="name">name</param>
|
/// <param name="name">name</param>
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public ChildCat(ChildCatAllOfPetType petType, Option<string> name = default) : base(ChildCatAllOfPetTypeValueConverter.ToJsonValue(petType))
|
public ChildCat(Option<string> name = default) : base()
|
||||||
{
|
{
|
||||||
PetType = petType;
|
|
||||||
NameOption = name;
|
NameOption = name;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
@ -45,10 +43,11 @@ namespace Org.OpenAPITools.Model
|
|||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PetType
|
/// The discriminator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("pet_type")]
|
[JsonIgnore]
|
||||||
public new ChildCatAllOfPetType PetType { get; set; }
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public new ChildCatAllOfPetType PetType { get; } = (ChildCatAllOfPetType)Enum.Parse(typeof(ChildCatAllOfPetType), "ChildCat");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Name
|
/// Used to track the state of Name
|
||||||
@ -72,7 +71,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class ChildCat {\n");
|
sb.Append("class ChildCat {\n");
|
||||||
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\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(" Name: ").Append(Name).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -142,7 +140,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (name.IsSet && name.Value == null)
|
if (name.IsSet && name.Value == null)
|
||||||
throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat.");
|
throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat.");
|
||||||
|
|
||||||
return new ChildCat(petType.Value.Value, name);
|
return new ChildCat(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -156,7 +154,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, childCat, jsonSerializerOptions);
|
WriteProperties(writer, childCat, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,13 +165,12 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="childCat"></param>
|
/// <param name="childCat"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (childCat.NameOption.IsSet && childCat.Name == null)
|
if (childCat.NameOption.IsSet && childCat.Name == null)
|
||||||
throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat.");
|
throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat.");
|
||||||
|
|
||||||
var petTypeRawValue = ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType);
|
writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType));
|
||||||
writer.WriteString("pet_type", petTypeRawValue);
|
|
||||||
|
|
||||||
if (childCat.NameOption.IsSet)
|
if (childCat.NameOption.IsSet)
|
||||||
writer.WriteString("name", childCat.Name);
|
writer.WriteString("name", childCat.Name);
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, classModel, jsonSerializerOptions);
|
WriteProperties(writer, classModel, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="classModel"></param>
|
/// <param name="classModel"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (classModel.ClassOption.IsSet && classModel.Class == null)
|
if (classModel.ClassOption.IsSet && classModel.Class == null)
|
||||||
throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel.");
|
throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel.");
|
||||||
|
@ -166,7 +166,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, complexQuadrilateral, jsonSerializerOptions);
|
WriteProperties(writer, complexQuadrilateral, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="complexQuadrilateral"></param>
|
/// <param name="complexQuadrilateral"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (complexQuadrilateral.QuadrilateralType == null)
|
if (complexQuadrilateral.QuadrilateralType == null)
|
||||||
throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral.");
|
throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral.");
|
||||||
|
@ -147,7 +147,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, danishPig, jsonSerializerOptions);
|
WriteProperties(writer, danishPig, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="danishPig"></param>
|
/// <param name="danishPig"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (danishPig.ClassName == null)
|
if (danishPig.ClassName == null)
|
||||||
throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig.");
|
throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig.");
|
||||||
|
@ -158,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, dateOnlyClass, jsonSerializerOptions);
|
WriteProperties(writer, dateOnlyClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="dateOnlyClass"></param>
|
/// <param name="dateOnlyClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (dateOnlyClass.DateOnlyPropertyOption.IsSet)
|
if (dateOnlyClass.DateOnlyPropertyOption.IsSet)
|
||||||
writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat));
|
writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat));
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, deprecatedObject, jsonSerializerOptions);
|
WriteProperties(writer, deprecatedObject, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="deprecatedObject"></param>
|
/// <param name="deprecatedObject"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null)
|
if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null)
|
||||||
throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject.");
|
throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject.");
|
||||||
|
@ -32,11 +32,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Dog" /> class.
|
/// Initializes a new instance of the <see cref="Dog" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="className">className</param>
|
|
||||||
/// <param name="breed">breed</param>
|
/// <param name="breed">breed</param>
|
||||||
/// <param name="color">color (default to "red")</param>
|
/// <param name="color">color (default to "red")</param>
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Dog(string className, Option<string> breed = default, Option<string> color = default) : base(className, color)
|
public Dog(Option<string> breed = default, Option<string> color = default) : base(color)
|
||||||
{
|
{
|
||||||
BreedOption = breed;
|
BreedOption = breed;
|
||||||
OnCreated();
|
OnCreated();
|
||||||
@ -44,6 +43,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public new string ClassName { get; } = "Dog";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the state of Breed
|
/// Used to track the state of Breed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -140,7 +146,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (color.IsSet && color.Value == null)
|
if (color.IsSet && color.Value == null)
|
||||||
throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog.");
|
throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog.");
|
||||||
|
|
||||||
return new Dog(className.Value, breed, color);
|
return new Dog(breed, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -154,7 +160,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, dog, jsonSerializerOptions);
|
WriteProperties(writer, dog, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,11 +171,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="dog"></param>
|
/// <param name="dog"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (dog.ClassName == null)
|
|
||||||
throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog.");
|
|
||||||
|
|
||||||
if (dog.BreedOption.IsSet && dog.Breed == null)
|
if (dog.BreedOption.IsSet && dog.Breed == null)
|
||||||
throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog.");
|
throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog.");
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, drawing, jsonSerializerOptions);
|
WriteProperties(writer, drawing, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="drawing"></param>
|
/// <param name="drawing"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (drawing.MainShapeOption.IsSet && drawing.MainShape == null)
|
if (drawing.MainShapeOption.IsSet && drawing.MainShape == null)
|
||||||
throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing.");
|
throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing.");
|
||||||
|
@ -177,7 +177,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, enumArrays, jsonSerializerOptions);
|
WriteProperties(writer, enumArrays, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="enumArrays"></param>
|
/// <param name="enumArrays"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null)
|
if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null)
|
||||||
throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays.");
|
throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays.");
|
||||||
|
@ -346,7 +346,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, enumTest, jsonSerializerOptions);
|
WriteProperties(writer, enumTest, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="enumTest"></param>
|
/// <param name="enumTest"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired);
|
var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired);
|
||||||
writer.WriteString("enum_string_required", enumStringRequiredRawValue);
|
writer.WriteString("enum_string_required", enumStringRequiredRawValue);
|
||||||
|
@ -166,7 +166,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, equilateralTriangle, jsonSerializerOptions);
|
WriteProperties(writer, equilateralTriangle, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="equilateralTriangle"></param>
|
/// <param name="equilateralTriangle"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (equilateralTriangle.ShapeType == null)
|
if (equilateralTriangle.ShapeType == null)
|
||||||
throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle.");
|
throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle.");
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, file, jsonSerializerOptions);
|
WriteProperties(writer, file, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="file"></param>
|
/// <param name="file"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (file.SourceURIOption.IsSet && file.SourceURI == null)
|
if (file.SourceURIOption.IsSet && file.SourceURI == null)
|
||||||
throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File.");
|
throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File.");
|
||||||
|
@ -176,7 +176,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, fileSchemaTestClass, jsonSerializerOptions);
|
WriteProperties(writer, fileSchemaTestClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="fileSchemaTestClass"></param>
|
/// <param name="fileSchemaTestClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null)
|
if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null)
|
||||||
throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass.");
|
throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass.");
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, foo, jsonSerializerOptions);
|
WriteProperties(writer, foo, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="foo"></param>
|
/// <param name="foo"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (foo.BarOption.IsSet && foo.Bar == null)
|
if (foo.BarOption.IsSet && foo.Bar == null)
|
||||||
throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo.");
|
throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo.");
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, fooGetDefaultResponse, jsonSerializerOptions);
|
WriteProperties(writer, fooGetDefaultResponse, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="fooGetDefaultResponse"></param>
|
/// <param name="fooGetDefaultResponse"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null)
|
if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null)
|
||||||
throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse.");
|
throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse.");
|
||||||
|
@ -703,7 +703,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, formatTest, jsonSerializerOptions);
|
WriteProperties(writer, formatTest, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="formatTest"></param>
|
/// <param name="formatTest"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (formatTest.Byte == null)
|
if (formatTest.Byte == null)
|
||||||
throw new ArgumentNullException(nameof(formatTest.Byte), "Property is required for class FormatTest.");
|
throw new ArgumentNullException(nameof(formatTest.Byte), "Property is required for class FormatTest.");
|
||||||
|
@ -195,7 +195,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, fruit, jsonSerializerOptions);
|
WriteProperties(writer, fruit, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="fruit"></param>
|
/// <param name="fruit"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (fruit.ColorOption.IsSet && fruit.Color == null)
|
if (fruit.ColorOption.IsSet && fruit.Color == null)
|
||||||
throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit.");
|
throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit.");
|
||||||
|
@ -169,7 +169,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, fruitReq, jsonSerializerOptions);
|
WriteProperties(writer, fruitReq, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="fruitReq"></param>
|
/// <param name="fruitReq"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -203,16 +203,16 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null)
|
if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null)
|
||||||
{
|
{
|
||||||
AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType()));
|
AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType()));
|
||||||
AppleJsonConverter.WriteProperties(ref writer, gmFruit.AppleOption.Value, jsonSerializerOptions);
|
AppleJsonConverter.WriteProperties(writer, gmFruit.AppleOption.Value, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null)
|
if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null)
|
||||||
{
|
{
|
||||||
BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType()));
|
BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType()));
|
||||||
BananaJsonConverter.WriteProperties(ref writer, gmFruit.BananaOption.Value, jsonSerializerOptions);
|
BananaJsonConverter.WriteProperties(writer, gmFruit.BananaOption.Value, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, gmFruit, jsonSerializerOptions);
|
WriteProperties(writer, gmFruit, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="gmFruit"></param>
|
/// <param name="gmFruit"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (gmFruit.ColorOption.IsSet && gmFruit.Color == null)
|
if (gmFruit.ColorOption.IsSet && gmFruit.Color == null)
|
||||||
throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit.");
|
throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit.");
|
||||||
|
@ -32,21 +32,20 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="GrandparentAnimal" /> class.
|
/// Initializes a new instance of the <see cref="GrandparentAnimal" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="petType">petType</param>
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public GrandparentAnimal(string petType)
|
public GrandparentAnimal()
|
||||||
{
|
{
|
||||||
PetType = petType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PetType
|
/// The discriminator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("pet_type")]
|
[JsonIgnore]
|
||||||
public string PetType { get; set; }
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public string PetType { get; } = "GrandparentAnimal";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
@ -62,7 +61,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class GrandparentAnimal {\n");
|
sb.Append("class GrandparentAnimal {\n");
|
||||||
sb.Append(" PetType: ").Append(PetType).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -113,6 +111,14 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
Option<string> petType = default;
|
Option<string> petType = default;
|
||||||
|
|
||||||
|
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("ChildCat"))
|
||||||
|
return JsonSerializer.Deserialize<ChildCat>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("ParentPet"))
|
||||||
|
return JsonSerializer.Deserialize<ParentPet>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
while (utf8JsonReader.Read())
|
while (utf8JsonReader.Read())
|
||||||
{
|
{
|
||||||
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
@ -143,7 +149,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (petType.IsSet && petType.Value == null)
|
if (petType.IsSet && petType.Value == null)
|
||||||
throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal.");
|
throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal.");
|
||||||
|
|
||||||
return new GrandparentAnimal(petType.Value);
|
return new GrandparentAnimal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -155,9 +161,19 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions)
|
public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
if (grandparentAnimal is ChildCat childCat){
|
||||||
|
JsonSerializer.Serialize<ChildCat>(writer, childCat, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grandparentAnimal is ParentPet parentPet){
|
||||||
|
JsonSerializer.Serialize<ParentPet>(writer, parentPet, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, grandparentAnimal, jsonSerializerOptions);
|
WriteProperties(writer, grandparentAnimal, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,11 +184,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="grandparentAnimal"></param>
|
/// <param name="grandparentAnimal"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (grandparentAnimal.PetType == null)
|
|
||||||
throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal.");
|
|
||||||
|
|
||||||
writer.WriteString("pet_type", grandparentAnimal.PetType);
|
writer.WriteString("pet_type", grandparentAnimal.PetType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, hasOnlyReadOnly, jsonSerializerOptions);
|
WriteProperties(writer, hasOnlyReadOnly, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="hasOnlyReadOnly"></param>
|
/// <param name="hasOnlyReadOnly"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null)
|
if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null)
|
||||||
throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly.");
|
throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly.");
|
||||||
|
@ -148,7 +148,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, healthCheckResult, jsonSerializerOptions);
|
WriteProperties(writer, healthCheckResult, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="healthCheckResult"></param>
|
/// <param name="healthCheckResult"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (healthCheckResult.NullableMessageOption.IsSet)
|
if (healthCheckResult.NullableMessageOption.IsSet)
|
||||||
if (healthCheckResult.NullableMessageOption.Value != null)
|
if (healthCheckResult.NullableMessageOption.Value != null)
|
||||||
|
@ -159,7 +159,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, isoscelesTriangle, jsonSerializerOptions);
|
WriteProperties(writer, isoscelesTriangle, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="isoscelesTriangle"></param>
|
/// <param name="isoscelesTriangle"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (isoscelesTriangle.ShapeType == null)
|
if (isoscelesTriangle.ShapeType == null)
|
||||||
throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle.");
|
throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle.");
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, list, jsonSerializerOptions);
|
WriteProperties(writer, list, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="list"></param>
|
/// <param name="list"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (list.Var123ListOption.IsSet && list.Var123List == null)
|
if (list.Var123ListOption.IsSet && list.Var123List == null)
|
||||||
throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List.");
|
throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List.");
|
||||||
|
@ -174,7 +174,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, literalStringClass, jsonSerializerOptions);
|
WriteProperties(writer, literalStringClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="literalStringClass"></param>
|
/// <param name="literalStringClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null)
|
if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null)
|
||||||
throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass.");
|
throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass.");
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="whale"></param>
|
/// <param name="whale"></param>
|
||||||
/// <param name="className">className</param>
|
public Mammal(Whale whale)
|
||||||
public Mammal(Whale whale, string className)
|
|
||||||
{
|
{
|
||||||
Whale = whale;
|
Whale = whale;
|
||||||
ClassName = className;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="zebra"></param>
|
/// <param name="zebra"></param>
|
||||||
/// <param name="className">className</param>
|
public Mammal(Zebra zebra)
|
||||||
public Mammal(Zebra zebra, string className)
|
|
||||||
{
|
{
|
||||||
Zebra = zebra;
|
Zebra = zebra;
|
||||||
ClassName = className;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,11 +53,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
/// Initializes a new instance of the <see cref="Mammal" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pig"></param>
|
/// <param name="pig"></param>
|
||||||
/// <param name="className">className</param>
|
public Mammal(Pig pig)
|
||||||
public Mammal(Pig pig, string className)
|
|
||||||
{
|
{
|
||||||
Pig = pig;
|
Pig = pig;
|
||||||
ClassName = className;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,12 +76,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Pig Pig { get; set; }
|
public Pig Pig { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets ClassName
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("className")]
|
|
||||||
public string ClassName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -102,7 +90,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class Mammal {\n");
|
sb.Append("class Mammal {\n");
|
||||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -223,13 +210,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal.");
|
throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal.");
|
||||||
|
|
||||||
if (pig != null)
|
if (pig != null)
|
||||||
return new Mammal(pig, className.Value);
|
return new Mammal(pig);
|
||||||
|
|
||||||
if (whale != null)
|
if (whale != null)
|
||||||
return new Mammal(whale, className.Value);
|
return new Mammal(whale);
|
||||||
|
|
||||||
if (zebra != null)
|
if (zebra != null)
|
||||||
return new Mammal(zebra, className.Value);
|
return new Mammal(zebra);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -247,20 +234,20 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (mammal.Whale != null) {
|
if (mammal.Whale != null) {
|
||||||
WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType()));
|
WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType()));
|
||||||
whaleJsonConverter.WriteProperties(ref writer, mammal.Whale, jsonSerializerOptions);
|
whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mammal.Zebra != null) {
|
if (mammal.Zebra != null) {
|
||||||
ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType()));
|
ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType()));
|
||||||
zebraJsonConverter.WriteProperties(ref writer, mammal.Zebra, jsonSerializerOptions);
|
zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mammal.Pig != null) {
|
if (mammal.Pig != null) {
|
||||||
PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType()));
|
PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType()));
|
||||||
pigJsonConverter.WriteProperties(ref writer, mammal.Pig, jsonSerializerOptions);
|
pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, mammal, jsonSerializerOptions);
|
WriteProperties(writer, mammal, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,12 +258,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="mammal"></param>
|
/// <param name="mammal"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (mammal.ClassName == null)
|
|
||||||
throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal.");
|
|
||||||
|
|
||||||
writer.WriteString("className", mammal.ClassName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, mapTest, jsonSerializerOptions);
|
WriteProperties(writer, mapTest, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="mapTest"></param>
|
/// <param name="mapTest"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null)
|
if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null)
|
||||||
throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest.");
|
throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest.");
|
||||||
|
@ -236,7 +236,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, mixedPropertiesAndAdditionalPropertiesClass, jsonSerializerOptions);
|
WriteProperties(writer, mixedPropertiesAndAdditionalPropertiesClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="mixedPropertiesAndAdditionalPropertiesClass"></param>
|
/// <param name="mixedPropertiesAndAdditionalPropertiesClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null)
|
if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null)
|
||||||
throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass.");
|
throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass.");
|
||||||
|
@ -175,7 +175,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, model200Response, jsonSerializerOptions);
|
WriteProperties(writer, model200Response, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="model200Response"></param>
|
/// <param name="model200Response"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (model200Response.ClassOption.IsSet && model200Response.Class == null)
|
if (model200Response.ClassOption.IsSet && model200Response.Class == null)
|
||||||
throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response.");
|
throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response.");
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, modelClient, jsonSerializerOptions);
|
WriteProperties(writer, modelClient, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="modelClient"></param>
|
/// <param name="modelClient"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null)
|
if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null)
|
||||||
throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient.");
|
throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient.");
|
||||||
|
@ -260,7 +260,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, name, jsonSerializerOptions);
|
WriteProperties(writer, name, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (name.PropertyOption.IsSet && name.Property == null)
|
if (name.PropertyOption.IsSet && name.Property == null)
|
||||||
throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name.");
|
throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name.");
|
||||||
|
@ -168,7 +168,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, notificationtestGetElementsV1ResponseMPayload, jsonSerializerOptions);
|
WriteProperties(writer, notificationtestGetElementsV1ResponseMPayload, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="notificationtestGetElementsV1ResponseMPayload"></param>
|
/// <param name="notificationtestGetElementsV1ResponseMPayload"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null)
|
if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null)
|
||||||
throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload.");
|
throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload.");
|
||||||
|
@ -395,7 +395,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, nullableClass, jsonSerializerOptions);
|
WriteProperties(writer, nullableClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="nullableClass"></param>
|
/// <param name="nullableClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null)
|
if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null)
|
||||||
throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass.");
|
throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass.");
|
||||||
|
@ -150,7 +150,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, nullableGuidClass, jsonSerializerOptions);
|
WriteProperties(writer, nullableGuidClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="nullableGuidClass"></param>
|
/// <param name="nullableGuidClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (nullableGuidClass.UuidOption.IsSet)
|
if (nullableGuidClass.UuidOption.IsSet)
|
||||||
if (nullableGuidClass.UuidOption.Value != null)
|
if (nullableGuidClass.UuidOption.Value != null)
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="triangle"></param>
|
/// <param name="triangle"></param>
|
||||||
/// <param name="shapeType">shapeType</param>
|
public NullableShape(Triangle triangle)
|
||||||
public NullableShape(Triangle triangle, string shapeType)
|
|
||||||
{
|
{
|
||||||
Triangle = triangle;
|
Triangle = triangle;
|
||||||
ShapeType = shapeType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
/// Initializes a new instance of the <see cref="NullableShape" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="quadrilateral"></param>
|
/// <param name="quadrilateral"></param>
|
||||||
/// <param name="shapeType">shapeType</param>
|
public NullableShape(Quadrilateral quadrilateral)
|
||||||
public NullableShape(Quadrilateral quadrilateral, string shapeType)
|
|
||||||
{
|
{
|
||||||
Quadrilateral = quadrilateral;
|
Quadrilateral = quadrilateral;
|
||||||
ShapeType = shapeType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +61,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Quadrilateral Quadrilateral { get; set; }
|
public Quadrilateral Quadrilateral { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets ShapeType
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("shapeType")]
|
|
||||||
public string ShapeType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -85,7 +75,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class NullableShape {\n");
|
sb.Append("class NullableShape {\n");
|
||||||
sb.Append(" ShapeType: ").Append(ShapeType).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -200,10 +189,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape.");
|
throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape.");
|
||||||
|
|
||||||
if (quadrilateral != null)
|
if (quadrilateral != null)
|
||||||
return new NullableShape(quadrilateral, shapeType.Value);
|
return new NullableShape(quadrilateral);
|
||||||
|
|
||||||
if (triangle != null)
|
if (triangle != null)
|
||||||
return new NullableShape(triangle, shapeType.Value);
|
return new NullableShape(triangle);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -221,15 +210,15 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (nullableShape.Triangle != null) {
|
if (nullableShape.Triangle != null) {
|
||||||
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType()));
|
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType()));
|
||||||
triangleJsonConverter.WriteProperties(ref writer, nullableShape.Triangle, jsonSerializerOptions);
|
triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullableShape.Quadrilateral != null) {
|
if (nullableShape.Quadrilateral != null) {
|
||||||
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType()));
|
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType()));
|
||||||
quadrilateralJsonConverter.WriteProperties(ref writer, nullableShape.Quadrilateral, jsonSerializerOptions);
|
quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, nullableShape, jsonSerializerOptions);
|
WriteProperties(writer, nullableShape, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,12 +229,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="nullableShape"></param>
|
/// <param name="nullableShape"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (nullableShape.ShapeType == null)
|
|
||||||
throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape.");
|
|
||||||
|
|
||||||
writer.WriteString("shapeType", nullableShape.ShapeType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, numberOnly, jsonSerializerOptions);
|
WriteProperties(writer, numberOnly, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="numberOnly"></param>
|
/// <param name="numberOnly"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (numberOnly.JustNumberOption.IsSet)
|
if (numberOnly.JustNumberOption.IsSet)
|
||||||
writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value);
|
writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value);
|
||||||
|
@ -226,7 +226,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, objectWithDeprecatedFields, jsonSerializerOptions);
|
WriteProperties(writer, objectWithDeprecatedFields, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="objectWithDeprecatedFields"></param>
|
/// <param name="objectWithDeprecatedFields"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null)
|
if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null)
|
||||||
throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields.");
|
throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields.");
|
||||||
|
@ -138,7 +138,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, oneOfString, jsonSerializerOptions);
|
WriteProperties(writer, oneOfString, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="oneOfString"></param>
|
/// <param name="oneOfString"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, order, jsonSerializerOptions);
|
WriteProperties(writer, order, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="order"></param>
|
/// <param name="order"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (order.CompleteOption.IsSet)
|
if (order.CompleteOption.IsSet)
|
||||||
writer.WriteBoolean("complete", order.CompleteOption.Value.Value);
|
writer.WriteBoolean("complete", order.CompleteOption.Value.Value);
|
||||||
|
@ -199,7 +199,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, outerComposite, jsonSerializerOptions);
|
WriteProperties(writer, outerComposite, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="outerComposite"></param>
|
/// <param name="outerComposite"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null)
|
if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null)
|
||||||
throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite.");
|
throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite.");
|
||||||
|
@ -32,15 +32,21 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ParentPet" /> class.
|
/// Initializes a new instance of the <see cref="ParentPet" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="petType">petType</param>
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public ParentPet(string petType) : base(petType)
|
public ParentPet() : base()
|
||||||
{
|
{
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnCreated();
|
partial void OnCreated();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The discriminator
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||||
|
public new string PetType { get; } = "ParentPet";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -79,6 +85,11 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
Option<string> petType = default;
|
Option<string> petType = default;
|
||||||
|
|
||||||
|
string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type");
|
||||||
|
|
||||||
|
if (discriminator != null && discriminator.Equals("ChildCat"))
|
||||||
|
return JsonSerializer.Deserialize<ChildCat>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
|
||||||
|
|
||||||
while (utf8JsonReader.Read())
|
while (utf8JsonReader.Read())
|
||||||
{
|
{
|
||||||
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
|
||||||
@ -109,7 +120,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (petType.IsSet && petType.Value == null)
|
if (petType.IsSet && petType.Value == null)
|
||||||
throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet.");
|
throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet.");
|
||||||
|
|
||||||
return new ParentPet(petType.Value);
|
return new ParentPet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -121,9 +132,14 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions)
|
public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
if (parentPet is ChildCat childCat){
|
||||||
|
JsonSerializer.Serialize<ChildCat>(writer, childCat, jsonSerializerOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, parentPet, jsonSerializerOptions);
|
WriteProperties(writer, parentPet, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,11 +150,8 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="parentPet"></param>
|
/// <param name="parentPet"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (parentPet.PetType == null)
|
|
||||||
throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet.");
|
|
||||||
|
|
||||||
writer.WriteString("pet_type", parentPet.PetType);
|
writer.WriteString("pet_type", parentPet.PetType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, pet, jsonSerializerOptions);
|
WriteProperties(writer, pet, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="pet"></param>
|
/// <param name="pet"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (pet.Name == null)
|
if (pet.Name == null)
|
||||||
throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet.");
|
throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet.");
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="basquePig"></param>
|
/// <param name="basquePig"></param>
|
||||||
/// <param name="className">className</param>
|
public Pig(BasquePig basquePig)
|
||||||
public Pig(BasquePig basquePig, string className)
|
|
||||||
{
|
{
|
||||||
BasquePig = basquePig;
|
BasquePig = basquePig;
|
||||||
ClassName = className;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Pig" /> class.
|
/// Initializes a new instance of the <see cref="Pig" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="danishPig"></param>
|
/// <param name="danishPig"></param>
|
||||||
/// <param name="className">className</param>
|
public Pig(DanishPig danishPig)
|
||||||
public Pig(DanishPig danishPig, string className)
|
|
||||||
{
|
{
|
||||||
DanishPig = danishPig;
|
DanishPig = danishPig;
|
||||||
ClassName = className;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +61,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DanishPig DanishPig { get; set; }
|
public DanishPig DanishPig { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets ClassName
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("className")]
|
|
||||||
public string ClassName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -85,7 +75,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class Pig {\n");
|
sb.Append("class Pig {\n");
|
||||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -200,10 +189,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig.");
|
throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig.");
|
||||||
|
|
||||||
if (basquePig != null)
|
if (basquePig != null)
|
||||||
return new Pig(basquePig, className.Value);
|
return new Pig(basquePig);
|
||||||
|
|
||||||
if (danishPig != null)
|
if (danishPig != null)
|
||||||
return new Pig(danishPig, className.Value);
|
return new Pig(danishPig);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -221,15 +210,15 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (pig.BasquePig != null) {
|
if (pig.BasquePig != null) {
|
||||||
BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType()));
|
BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType()));
|
||||||
basquePigJsonConverter.WriteProperties(ref writer, pig.BasquePig, jsonSerializerOptions);
|
basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pig.DanishPig != null) {
|
if (pig.DanishPig != null) {
|
||||||
DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType()));
|
DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType()));
|
||||||
danishPigJsonConverter.WriteProperties(ref writer, pig.DanishPig, jsonSerializerOptions);
|
danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, pig, jsonSerializerOptions);
|
WriteProperties(writer, pig, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,12 +229,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="pig"></param>
|
/// <param name="pig"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (pig.ClassName == null)
|
|
||||||
throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig.");
|
|
||||||
|
|
||||||
writer.WriteString("className", pig.ClassName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, polymorphicProperty, jsonSerializerOptions);
|
WriteProperties(writer, polymorphicProperty, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="polymorphicProperty"></param>
|
/// <param name="polymorphicProperty"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="simpleQuadrilateral"></param>
|
/// <param name="simpleQuadrilateral"></param>
|
||||||
/// <param name="quadrilateralType">quadrilateralType</param>
|
public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral)
|
||||||
public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral, string quadrilateralType)
|
|
||||||
{
|
{
|
||||||
SimpleQuadrilateral = simpleQuadrilateral;
|
SimpleQuadrilateral = simpleQuadrilateral;
|
||||||
QuadrilateralType = quadrilateralType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
/// Initializes a new instance of the <see cref="Quadrilateral" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="complexQuadrilateral"></param>
|
/// <param name="complexQuadrilateral"></param>
|
||||||
/// <param name="quadrilateralType">quadrilateralType</param>
|
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral)
|
||||||
public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilateralType)
|
|
||||||
{
|
{
|
||||||
ComplexQuadrilateral = complexQuadrilateral;
|
ComplexQuadrilateral = complexQuadrilateral;
|
||||||
QuadrilateralType = quadrilateralType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +61,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
public ComplexQuadrilateral ComplexQuadrilateral { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets QuadrilateralType
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("quadrilateralType")]
|
|
||||||
public string QuadrilateralType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -85,7 +75,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class Quadrilateral {\n");
|
sb.Append("class Quadrilateral {\n");
|
||||||
sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -200,10 +189,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral.");
|
throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral.");
|
||||||
|
|
||||||
if (complexQuadrilateral != null)
|
if (complexQuadrilateral != null)
|
||||||
return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value);
|
return new Quadrilateral(complexQuadrilateral);
|
||||||
|
|
||||||
if (simpleQuadrilateral != null)
|
if (simpleQuadrilateral != null)
|
||||||
return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value);
|
return new Quadrilateral(simpleQuadrilateral);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -221,15 +210,15 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (quadrilateral.SimpleQuadrilateral != null) {
|
if (quadrilateral.SimpleQuadrilateral != null) {
|
||||||
SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType()));
|
SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType()));
|
||||||
simpleQuadrilateralJsonConverter.WriteProperties(ref writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions);
|
simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quadrilateral.ComplexQuadrilateral != null) {
|
if (quadrilateral.ComplexQuadrilateral != null) {
|
||||||
ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType()));
|
ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType()));
|
||||||
complexQuadrilateralJsonConverter.WriteProperties(ref writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions);
|
complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, quadrilateral, jsonSerializerOptions);
|
WriteProperties(writer, quadrilateral, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,12 +229,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="quadrilateral"></param>
|
/// <param name="quadrilateral"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (quadrilateral.QuadrilateralType == null)
|
|
||||||
throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral.");
|
|
||||||
|
|
||||||
writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, quadrilateralInterface, jsonSerializerOptions);
|
WriteProperties(writer, quadrilateralInterface, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="quadrilateralInterface"></param>
|
/// <param name="quadrilateralInterface"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (quadrilateralInterface.QuadrilateralType == null)
|
if (quadrilateralInterface.QuadrilateralType == null)
|
||||||
throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface.");
|
throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface.");
|
||||||
|
@ -212,7 +212,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, readOnlyFirst, jsonSerializerOptions);
|
WriteProperties(writer, readOnlyFirst, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="readOnlyFirst"></param>
|
/// <param name="readOnlyFirst"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null)
|
if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null)
|
||||||
throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst.");
|
throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst.");
|
||||||
|
@ -1086,7 +1086,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, requiredClass, jsonSerializerOptions);
|
WriteProperties(writer, requiredClass, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1097,7 +1097,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="requiredClass"></param>
|
/// <param name="requiredClass"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (requiredClass.RequiredNotnullableArrayOfString == null)
|
if (requiredClass.RequiredNotnullableArrayOfString == null)
|
||||||
throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass.");
|
throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass.");
|
||||||
|
@ -210,7 +210,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, varReturn, jsonSerializerOptions);
|
WriteProperties(writer, varReturn, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="varReturn"></param>
|
/// <param name="varReturn"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (varReturn.Lock == null)
|
if (varReturn.Lock == null)
|
||||||
throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return.");
|
throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return.");
|
||||||
|
@ -176,7 +176,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, rolesReportsHash, jsonSerializerOptions);
|
WriteProperties(writer, rolesReportsHash, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="rolesReportsHash"></param>
|
/// <param name="rolesReportsHash"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null)
|
if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null)
|
||||||
throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash.");
|
throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash.");
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, rolesReportsHashRole, jsonSerializerOptions);
|
WriteProperties(writer, rolesReportsHashRole, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="rolesReportsHashRole"></param>
|
/// <param name="rolesReportsHashRole"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null)
|
if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null)
|
||||||
throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole.");
|
throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole.");
|
||||||
|
@ -166,7 +166,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, scaleneTriangle, jsonSerializerOptions);
|
WriteProperties(writer, scaleneTriangle, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="scaleneTriangle"></param>
|
/// <param name="scaleneTriangle"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (scaleneTriangle.ShapeType == null)
|
if (scaleneTriangle.ShapeType == null)
|
||||||
throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle.");
|
throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle.");
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="triangle"></param>
|
/// <param name="triangle"></param>
|
||||||
/// <param name="shapeType">shapeType</param>
|
public Shape(Triangle triangle)
|
||||||
public Shape(Triangle triangle, string shapeType)
|
|
||||||
{
|
{
|
||||||
Triangle = triangle;
|
Triangle = triangle;
|
||||||
ShapeType = shapeType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Shape" /> class.
|
/// Initializes a new instance of the <see cref="Shape" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="quadrilateral"></param>
|
/// <param name="quadrilateral"></param>
|
||||||
/// <param name="shapeType">shapeType</param>
|
public Shape(Quadrilateral quadrilateral)
|
||||||
public Shape(Quadrilateral quadrilateral, string shapeType)
|
|
||||||
{
|
{
|
||||||
Quadrilateral = quadrilateral;
|
Quadrilateral = quadrilateral;
|
||||||
ShapeType = shapeType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +61,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Quadrilateral Quadrilateral { get; set; }
|
public Quadrilateral Quadrilateral { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets ShapeType
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("shapeType")]
|
|
||||||
public string ShapeType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -85,7 +75,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class Shape {\n");
|
sb.Append("class Shape {\n");
|
||||||
sb.Append(" ShapeType: ").Append(ShapeType).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -200,10 +189,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape.");
|
throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape.");
|
||||||
|
|
||||||
if (quadrilateral != null)
|
if (quadrilateral != null)
|
||||||
return new Shape(quadrilateral, shapeType.Value);
|
return new Shape(quadrilateral);
|
||||||
|
|
||||||
if (triangle != null)
|
if (triangle != null)
|
||||||
return new Shape(triangle, shapeType.Value);
|
return new Shape(triangle);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -221,15 +210,15 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (shape.Triangle != null) {
|
if (shape.Triangle != null) {
|
||||||
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType()));
|
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType()));
|
||||||
triangleJsonConverter.WriteProperties(ref writer, shape.Triangle, jsonSerializerOptions);
|
triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shape.Quadrilateral != null) {
|
if (shape.Quadrilateral != null) {
|
||||||
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType()));
|
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType()));
|
||||||
quadrilateralJsonConverter.WriteProperties(ref writer, shape.Quadrilateral, jsonSerializerOptions);
|
quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, shape, jsonSerializerOptions);
|
WriteProperties(writer, shape, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,12 +229,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="shape"></param>
|
/// <param name="shape"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (shape.ShapeType == null)
|
|
||||||
throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape.");
|
|
||||||
|
|
||||||
writer.WriteString("shapeType", shape.ShapeType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, shapeInterface, jsonSerializerOptions);
|
WriteProperties(writer, shapeInterface, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="shapeInterface"></param>
|
/// <param name="shapeInterface"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (shapeInterface.ShapeType == null)
|
if (shapeInterface.ShapeType == null)
|
||||||
throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface.");
|
throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface.");
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="triangle"></param>
|
/// <param name="triangle"></param>
|
||||||
/// <param name="shapeType">shapeType</param>
|
public ShapeOrNull(Triangle triangle)
|
||||||
public ShapeOrNull(Triangle triangle, string shapeType)
|
|
||||||
{
|
{
|
||||||
Triangle = triangle;
|
Triangle = triangle;
|
||||||
ShapeType = shapeType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
/// Initializes a new instance of the <see cref="ShapeOrNull" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="quadrilateral"></param>
|
/// <param name="quadrilateral"></param>
|
||||||
/// <param name="shapeType">shapeType</param>
|
public ShapeOrNull(Quadrilateral quadrilateral)
|
||||||
public ShapeOrNull(Quadrilateral quadrilateral, string shapeType)
|
|
||||||
{
|
{
|
||||||
Quadrilateral = quadrilateral;
|
Quadrilateral = quadrilateral;
|
||||||
ShapeType = shapeType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +61,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Quadrilateral Quadrilateral { get; set; }
|
public Quadrilateral Quadrilateral { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets ShapeType
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("shapeType")]
|
|
||||||
public string ShapeType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -85,7 +75,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class ShapeOrNull {\n");
|
sb.Append("class ShapeOrNull {\n");
|
||||||
sb.Append(" ShapeType: ").Append(ShapeType).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -200,10 +189,10 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull.");
|
throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull.");
|
||||||
|
|
||||||
if (quadrilateral != null)
|
if (quadrilateral != null)
|
||||||
return new ShapeOrNull(quadrilateral, shapeType.Value);
|
return new ShapeOrNull(quadrilateral);
|
||||||
|
|
||||||
if (triangle != null)
|
if (triangle != null)
|
||||||
return new ShapeOrNull(triangle, shapeType.Value);
|
return new ShapeOrNull(triangle);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -221,15 +210,15 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (shapeOrNull.Triangle != null) {
|
if (shapeOrNull.Triangle != null) {
|
||||||
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType()));
|
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType()));
|
||||||
triangleJsonConverter.WriteProperties(ref writer, shapeOrNull.Triangle, jsonSerializerOptions);
|
triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shapeOrNull.Quadrilateral != null) {
|
if (shapeOrNull.Quadrilateral != null) {
|
||||||
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType()));
|
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType()));
|
||||||
quadrilateralJsonConverter.WriteProperties(ref writer, shapeOrNull.Quadrilateral, jsonSerializerOptions);
|
quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, shapeOrNull, jsonSerializerOptions);
|
WriteProperties(writer, shapeOrNull, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,12 +229,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="shapeOrNull"></param>
|
/// <param name="shapeOrNull"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (shapeOrNull.ShapeType == null)
|
|
||||||
throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull.");
|
|
||||||
|
|
||||||
writer.WriteString("shapeType", shapeOrNull.ShapeType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, simpleQuadrilateral, jsonSerializerOptions);
|
WriteProperties(writer, simpleQuadrilateral, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="simpleQuadrilateral"></param>
|
/// <param name="simpleQuadrilateral"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (simpleQuadrilateral.QuadrilateralType == null)
|
if (simpleQuadrilateral.QuadrilateralType == null)
|
||||||
throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral.");
|
throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral.");
|
||||||
|
@ -175,7 +175,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, specialModelName, jsonSerializerOptions);
|
WriteProperties(writer, specialModelName, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="specialModelName"></param>
|
/// <param name="specialModelName"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null)
|
if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null)
|
||||||
throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName.");
|
throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName.");
|
||||||
|
@ -175,7 +175,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, tag, jsonSerializerOptions);
|
WriteProperties(writer, tag, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="tag"></param>
|
/// <param name="tag"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (tag.NameOption.IsSet && tag.Name == null)
|
if (tag.NameOption.IsSet && tag.Name == null)
|
||||||
throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag.");
|
throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag.");
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, testCollectionEndingWithWordList, jsonSerializerOptions);
|
WriteProperties(writer, testCollectionEndingWithWordList, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="testCollectionEndingWithWordList"></param>
|
/// <param name="testCollectionEndingWithWordList"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null)
|
if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null)
|
||||||
throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList.");
|
throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList.");
|
||||||
|
@ -152,7 +152,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, testCollectionEndingWithWordListObject, jsonSerializerOptions);
|
WriteProperties(writer, testCollectionEndingWithWordListObject, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="testCollectionEndingWithWordListObject"></param>
|
/// <param name="testCollectionEndingWithWordListObject"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null)
|
if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null)
|
||||||
throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject.");
|
throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject.");
|
||||||
|
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, testInlineFreeformAdditionalPropertiesRequest, jsonSerializerOptions);
|
WriteProperties(writer, testInlineFreeformAdditionalPropertiesRequest, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="testInlineFreeformAdditionalPropertiesRequest"></param>
|
/// <param name="testInlineFreeformAdditionalPropertiesRequest"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null)
|
if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null)
|
||||||
throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest.");
|
throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest.");
|
||||||
|
@ -33,11 +33,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="equilateralTriangle"></param>
|
/// <param name="equilateralTriangle"></param>
|
||||||
/// <param name="triangleType">triangleType</param>
|
public Triangle(EquilateralTriangle equilateralTriangle)
|
||||||
public Triangle(EquilateralTriangle equilateralTriangle, string triangleType)
|
|
||||||
{
|
{
|
||||||
EquilateralTriangle = equilateralTriangle;
|
EquilateralTriangle = equilateralTriangle;
|
||||||
TriangleType = triangleType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +43,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="isoscelesTriangle"></param>
|
/// <param name="isoscelesTriangle"></param>
|
||||||
/// <param name="triangleType">triangleType</param>
|
public Triangle(IsoscelesTriangle isoscelesTriangle)
|
||||||
public Triangle(IsoscelesTriangle isoscelesTriangle, string triangleType)
|
|
||||||
{
|
{
|
||||||
IsoscelesTriangle = isoscelesTriangle;
|
IsoscelesTriangle = isoscelesTriangle;
|
||||||
TriangleType = triangleType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,11 +53,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
/// Initializes a new instance of the <see cref="Triangle" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scaleneTriangle"></param>
|
/// <param name="scaleneTriangle"></param>
|
||||||
/// <param name="triangleType">triangleType</param>
|
public Triangle(ScaleneTriangle scaleneTriangle)
|
||||||
public Triangle(ScaleneTriangle scaleneTriangle, string triangleType)
|
|
||||||
{
|
{
|
||||||
ScaleneTriangle = scaleneTriangle;
|
ScaleneTriangle = scaleneTriangle;
|
||||||
TriangleType = triangleType;
|
|
||||||
OnCreated();
|
OnCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,12 +76,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ScaleneTriangle ScaleneTriangle { get; set; }
|
public ScaleneTriangle ScaleneTriangle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets TriangleType
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("triangleType")]
|
|
||||||
public string TriangleType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets additional properties
|
/// Gets or Sets additional properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -102,7 +90,6 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("class Triangle {\n");
|
sb.Append("class Triangle {\n");
|
||||||
sb.Append(" TriangleType: ").Append(TriangleType).Append("\n");
|
|
||||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
@ -223,13 +210,13 @@ namespace Org.OpenAPITools.Model
|
|||||||
throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle.");
|
throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle.");
|
||||||
|
|
||||||
if (equilateralTriangle != null)
|
if (equilateralTriangle != null)
|
||||||
return new Triangle(equilateralTriangle, triangleType.Value);
|
return new Triangle(equilateralTriangle);
|
||||||
|
|
||||||
if (isoscelesTriangle != null)
|
if (isoscelesTriangle != null)
|
||||||
return new Triangle(isoscelesTriangle, triangleType.Value);
|
return new Triangle(isoscelesTriangle);
|
||||||
|
|
||||||
if (scaleneTriangle != null)
|
if (scaleneTriangle != null)
|
||||||
return new Triangle(scaleneTriangle, triangleType.Value);
|
return new Triangle(scaleneTriangle);
|
||||||
|
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
@ -247,20 +234,20 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
if (triangle.EquilateralTriangle != null) {
|
if (triangle.EquilateralTriangle != null) {
|
||||||
EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType()));
|
EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType()));
|
||||||
equilateralTriangleJsonConverter.WriteProperties(ref writer, triangle.EquilateralTriangle, jsonSerializerOptions);
|
equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triangle.IsoscelesTriangle != null) {
|
if (triangle.IsoscelesTriangle != null) {
|
||||||
IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType()));
|
IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType()));
|
||||||
isoscelesTriangleJsonConverter.WriteProperties(ref writer, triangle.IsoscelesTriangle, jsonSerializerOptions);
|
isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triangle.ScaleneTriangle != null) {
|
if (triangle.ScaleneTriangle != null) {
|
||||||
ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType()));
|
ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType()));
|
||||||
scaleneTriangleJsonConverter.WriteProperties(ref writer, triangle.ScaleneTriangle, jsonSerializerOptions);
|
scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteProperties(ref writer, triangle, jsonSerializerOptions);
|
WriteProperties(writer, triangle, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,12 +258,9 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="triangle"></param>
|
/// <param name="triangle"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (triangle.TriangleType == null)
|
|
||||||
throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle.");
|
|
||||||
|
|
||||||
writer.WriteString("triangleType", triangle.TriangleType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, triangleInterface, jsonSerializerOptions);
|
WriteProperties(writer, triangleInterface, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="triangleInterface"></param>
|
/// <param name="triangleInterface"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (triangleInterface.TriangleType == null)
|
if (triangleInterface.TriangleType == null)
|
||||||
throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface.");
|
throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface.");
|
||||||
|
@ -406,7 +406,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, user, jsonSerializerOptions);
|
WriteProperties(writer, user, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (user.EmailOption.IsSet && user.Email == null)
|
if (user.EmailOption.IsSet && user.Email == null)
|
||||||
throw new ArgumentNullException(nameof(user.Email), "Property is required for class User.");
|
throw new ArgumentNullException(nameof(user.Email), "Property is required for class User.");
|
||||||
|
@ -195,7 +195,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
{
|
{
|
||||||
writer.WriteStartObject();
|
writer.WriteStartObject();
|
||||||
|
|
||||||
WriteProperties(ref writer, whale, jsonSerializerOptions);
|
WriteProperties(writer, whale, jsonSerializerOptions);
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <param name="whale"></param>
|
/// <param name="whale"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions)
|
public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions)
|
||||||
{
|
{
|
||||||
if (whale.ClassName == null)
|
if (whale.ClassName == null)
|
||||||
throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale.");
|
throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale.");
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user