removed a warning (#16037)

This commit is contained in:
devhl-labs 2023-07-08 22:26:59 -04:00 committed by GitHub
parent 1d470c3866
commit c6877947ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

View File

@ -540,6 +540,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
if (allOf != null) {
for(CodegenProperty property : allOf) {
property.name = patchPropertyName(model, property.baseType);
patchPropertyVendorExtensinos(property);
}
}
@ -549,6 +550,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
for(CodegenProperty property : anyOf) {
property.name = patchPropertyName(model, property.baseType);
property.isNullable = true;
patchPropertyVendorExtensinos(property);
}
}
@ -558,6 +560,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
for(CodegenProperty property : oneOf) {
property.name = patchPropertyName(model, property.baseType);
property.isNullable = true;
patchPropertyVendorExtensinos(property);
}
}
}
@ -632,6 +635,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
return value;
}
private void patchPropertyVendorExtensinos(CodegenProperty property) {
Boolean isValueType = isValueType(property);
property.vendorExtensions.put("x-is-value-type", isValueType);
property.vendorExtensions.put("x-is-reference-type", !isValueType);
property.vendorExtensions.put("x-is-nullable-type", this.getNullableReferencesTypes() || isValueType);
}
protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
if (enumRefs.containsKey(property.dataType)) {
// Handle any enum properties referred to by $ref.
@ -645,17 +655,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
property.isPrimitiveType = true;
}
Boolean isValueType = isValueType(property);
property.vendorExtensions.put("x-is-value-type", isValueType);
if (property.isNullable && !property.isContainer && isValueType) {
property.vendorExtensions.put("x-nullable-value-type", true);
}
if (this.getNullableReferencesTypes() || isValueType) {
property.vendorExtensions.put("x-nullable-type", true);
}
patchPropertyVendorExtensinos(property);
String tmpPropertyName = escapeReservedWord(model, property.name);
property.name = patchPropertyName(model, property.name);

View File

@ -38,7 +38,7 @@
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
{{#allVars}}
{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{#nrt}}{{#lambda.optional}}{{{datatypeWithEnum}}}{{/lambda.optional}}{{/nrt}}{{^nrt}}{{{datatypeWithEnum}}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default;
{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default;
{{#-last}}
{{/-last}}

View File

@ -77,7 +77,7 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Gets or Sets VarBool
/// </summary>
public bool VarBool { get; set; }
public bool? VarBool { get; set; }
/// <summary>
/// Gets or Sets VarString
@ -146,7 +146,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
bool varBool = default;
bool? varBool = default;
string varString = default;
Object varObject = default;
List<string> list = default;
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
{
Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader;
OpenAPIClientUtils.TryDeserialize<bool>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
OpenAPIClientUtils.TryDeserialize<bool?>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader;
OpenAPIClientUtils.TryDeserialize<string>(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString);

View File

@ -77,7 +77,7 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Gets or Sets VarBool
/// </summary>
public bool VarBool { get; set; }
public bool? VarBool { get; set; }
/// <summary>
/// Gets or Sets VarString
@ -146,7 +146,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
bool varBool = default;
bool? varBool = default;
string varString = default;
Object varObject = default;
List<string> list = default;
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
{
Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader;
OpenAPIClientUtils.TryDeserialize<bool>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
OpenAPIClientUtils.TryDeserialize<bool?>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader;
OpenAPIClientUtils.TryDeserialize<string>(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString);