forked from loafle/openapi-generator-original
removed a warning (#16037)
This commit is contained in:
parent
1d470c3866
commit
c6877947ac
@ -540,6 +540,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
if (allOf != null) {
|
if (allOf != null) {
|
||||||
for(CodegenProperty property : allOf) {
|
for(CodegenProperty property : allOf) {
|
||||||
property.name = patchPropertyName(model, property.baseType);
|
property.name = patchPropertyName(model, property.baseType);
|
||||||
|
patchPropertyVendorExtensinos(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +550,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
for(CodegenProperty property : anyOf) {
|
for(CodegenProperty property : anyOf) {
|
||||||
property.name = patchPropertyName(model, property.baseType);
|
property.name = patchPropertyName(model, property.baseType);
|
||||||
property.isNullable = true;
|
property.isNullable = true;
|
||||||
|
patchPropertyVendorExtensinos(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,6 +560,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
for(CodegenProperty property : oneOf) {
|
for(CodegenProperty property : oneOf) {
|
||||||
property.name = patchPropertyName(model, property.baseType);
|
property.name = patchPropertyName(model, property.baseType);
|
||||||
property.isNullable = true;
|
property.isNullable = true;
|
||||||
|
patchPropertyVendorExtensinos(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,6 +635,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
return value;
|
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) {
|
protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
|
||||||
if (enumRefs.containsKey(property.dataType)) {
|
if (enumRefs.containsKey(property.dataType)) {
|
||||||
// Handle any enum properties referred to by $ref.
|
// Handle any enum properties referred to by $ref.
|
||||||
@ -645,17 +655,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean isValueType = isValueType(property);
|
patchPropertyVendorExtensinos(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
String tmpPropertyName = escapeReservedWord(model, property.name);
|
String tmpPropertyName = escapeReservedWord(model, property.name);
|
||||||
property.name = patchPropertyName(model, property.name);
|
property.name = patchPropertyName(model, property.name);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
{{#allVars}}
|
{{#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}}
|
||||||
|
|
||||||
{{/-last}}
|
{{/-last}}
|
||||||
|
@ -77,7 +77,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets VarBool
|
/// Gets or Sets VarBool
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool VarBool { get; set; }
|
public bool? VarBool { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets VarString
|
/// Gets or Sets VarString
|
||||||
@ -146,7 +146,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
bool varBool = default;
|
bool? varBool = default;
|
||||||
string varString = default;
|
string varString = default;
|
||||||
Object varObject = default;
|
Object varObject = default;
|
||||||
List<string> list = default;
|
List<string> list = default;
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
|
if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
|
||||||
{
|
{
|
||||||
Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader;
|
Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader;
|
||||||
OpenAPIClientUtils.TryDeserialize<bool>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
|
OpenAPIClientUtils.TryDeserialize<bool?>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
|
||||||
|
|
||||||
Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader;
|
Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader;
|
||||||
OpenAPIClientUtils.TryDeserialize<string>(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString);
|
OpenAPIClientUtils.TryDeserialize<string>(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString);
|
||||||
|
@ -77,7 +77,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets VarBool
|
/// Gets or Sets VarBool
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool VarBool { get; set; }
|
public bool? VarBool { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets VarString
|
/// Gets or Sets VarString
|
||||||
@ -146,7 +146,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
|
|
||||||
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||||
|
|
||||||
bool varBool = default;
|
bool? varBool = default;
|
||||||
string varString = default;
|
string varString = default;
|
||||||
Object varObject = default;
|
Object varObject = default;
|
||||||
List<string> list = default;
|
List<string> list = default;
|
||||||
@ -163,7 +163,7 @@ namespace Org.OpenAPITools.Model
|
|||||||
if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
|
if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
|
||||||
{
|
{
|
||||||
Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader;
|
Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader;
|
||||||
OpenAPIClientUtils.TryDeserialize<bool>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
|
OpenAPIClientUtils.TryDeserialize<bool?>(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool);
|
||||||
|
|
||||||
Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader;
|
Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader;
|
||||||
OpenAPIClientUtils.TryDeserialize<string>(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString);
|
OpenAPIClientUtils.TryDeserialize<string>(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user