From c109399f3fece2d4ebd1353fb3e4deb6f00b1ee6 Mon Sep 17 00:00:00 2001 From: devhl-labs Date: Tue, 16 Apr 2024 03:09:15 -0400 Subject: [PATCH] fixed property naming convention for composed types (#18312) --- .../languages/AbstractCSharpCodegen.java | 6 ++-- .../src/Org.OpenAPITools/Model/OneOfString.cs | 10 +++---- .../Model/PolymorphicProperty.cs | 28 +++++++++---------- .../src/Org.OpenAPITools/Model/OneOfString.cs | 10 +++---- .../Model/PolymorphicProperty.cs | 28 +++++++++---------- .../src/Org.OpenAPITools/Model/OneOfString.cs | 10 +++---- .../Model/PolymorphicProperty.cs | 28 +++++++++---------- .../src/Org.OpenAPITools/Model/OneOfString.cs | 10 +++---- .../Model/PolymorphicProperty.cs | 28 +++++++++---------- .../src/Org.OpenAPITools/Model/OneOfString.cs | 10 +++---- .../Model/PolymorphicProperty.cs | 28 +++++++++---------- 11 files changed, 98 insertions(+), 98 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 990bb1eedb17..ddb24d37bf65 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -585,7 +585,7 @@ public Map postProcessAllModels(Map objs) List allOf = composedSchemas.getAllOf(); if (allOf != null) { for (CodegenProperty property : allOf) { - property.name = patchPropertyName(model, property.baseType); + property.name = patchPropertyName(model, camelize(property.baseType)); patchPropertyVendorExtensions(property); } } @@ -594,7 +594,7 @@ public Map postProcessAllModels(Map objs) if (anyOf != null) { removePropertiesDeclaredInComposedTypes(objs, model, anyOf); for (CodegenProperty property : anyOf) { - property.name = patchPropertyName(model, property.baseType); + property.name = patchPropertyName(model, camelize(property.baseType)); property.isNullable = true; patchPropertyVendorExtensions(property); } @@ -604,7 +604,7 @@ public Map postProcessAllModels(Map objs) if (oneOf != null) { removePropertiesDeclaredInComposedTypes(objs, model, oneOf); for (CodegenProperty property : oneOf) { - property.name = patchPropertyName(model, property.baseType); + property.name = patchPropertyName(model, camelize(property.baseType)); property.isNullable = true; patchPropertyVendorExtensions(property); } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs index 6e94b861b234..258453564b0b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs @@ -32,19 +32,19 @@ public partial class OneOfString : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal OneOfString(string varString) + /// + internal OneOfString(string @string) { - VarString = varString; + String = @string; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string VarString { get; set; } + public string String { get; set; } /// /// Gets or Sets additional properties diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 85e19cd25d2d..ef0c2937c6ce 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -32,20 +32,20 @@ public partial class PolymorphicProperty : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(bool varBool) + /// + internal PolymorphicProperty(bool @bool) { - VarBool = varBool; + Bool = @bool; OnCreated(); } /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(string varString) + /// + internal PolymorphicProperty(string @string) { - VarString = varString; + String = @string; OnCreated(); } @@ -72,14 +72,14 @@ internal PolymorphicProperty(List list) partial void OnCreated(); /// - /// Gets or Sets VarBool + /// Gets or Sets Bool /// - public bool? VarBool { get; set; } + public bool? Bool { get; set; } /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string VarString { get; set; } + public string String { get; set; } /// /// Gets or Sets Object @@ -159,11 +159,11 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { - Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); - Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs index abab41e9e99e..92cc112087e3 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs @@ -34,19 +34,19 @@ public partial class OneOfString : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal OneOfString(string varString) + /// + internal OneOfString(string @string) { - VarString = varString; + String = @string; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string? VarString { get; set; } + public string? String { get; set; } /// /// Gets or Sets additional properties diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index dceaef0f4f7c..b611a3120a22 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -34,20 +34,20 @@ public partial class PolymorphicProperty : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(bool varBool) + /// + internal PolymorphicProperty(bool @bool) { - VarBool = varBool; + Bool = @bool; OnCreated(); } /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(string varString) + /// + internal PolymorphicProperty(string @string) { - VarString = varString; + String = @string; OnCreated(); } @@ -74,14 +74,14 @@ internal PolymorphicProperty(List list) partial void OnCreated(); /// - /// Gets or Sets VarBool + /// Gets or Sets Bool /// - public bool? VarBool { get; set; } + public bool? Bool { get; set; } /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string? VarString { get; set; } + public string? String { get; set; } /// /// Gets or Sets Object @@ -161,11 +161,11 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { - Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); - Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs index 6e94b861b234..258453564b0b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs @@ -32,19 +32,19 @@ public partial class OneOfString : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal OneOfString(string varString) + /// + internal OneOfString(string @string) { - VarString = varString; + String = @string; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string VarString { get; set; } + public string String { get; set; } /// /// Gets or Sets additional properties diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 85e19cd25d2d..ef0c2937c6ce 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -32,20 +32,20 @@ public partial class PolymorphicProperty : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(bool varBool) + /// + internal PolymorphicProperty(bool @bool) { - VarBool = varBool; + Bool = @bool; OnCreated(); } /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(string varString) + /// + internal PolymorphicProperty(string @string) { - VarString = varString; + String = @string; OnCreated(); } @@ -72,14 +72,14 @@ internal PolymorphicProperty(List list) partial void OnCreated(); /// - /// Gets or Sets VarBool + /// Gets or Sets Bool /// - public bool? VarBool { get; set; } + public bool? Bool { get; set; } /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string VarString { get; set; } + public string String { get; set; } /// /// Gets or Sets Object @@ -159,11 +159,11 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { - Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); - Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs index b8e81d159ba5..a4772470b488 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs @@ -35,19 +35,19 @@ public partial class OneOfString : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal OneOfString(string varString) + /// + internal OneOfString(string @string) { - VarString = varString; + String = @string; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string? VarString { get; set; } + public string? String { get; set; } /// /// Gets or Sets additional properties diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 16c6d68ac576..6a979e314ef0 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -35,20 +35,20 @@ public partial class PolymorphicProperty : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(bool varBool) + /// + internal PolymorphicProperty(bool @bool) { - VarBool = varBool; + Bool = @bool; OnCreated(); } /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(string varString) + /// + internal PolymorphicProperty(string @string) { - VarString = varString; + String = @string; OnCreated(); } @@ -75,14 +75,14 @@ internal PolymorphicProperty(List list) partial void OnCreated(); /// - /// Gets or Sets VarBool + /// Gets or Sets Bool /// - public bool? VarBool { get; set; } + public bool? Bool { get; set; } /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string? VarString { get; set; } + public string? String { get; set; } /// /// Gets or Sets Object @@ -162,11 +162,11 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { - Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); - Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs index 6e94b861b234..258453564b0b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs @@ -32,19 +32,19 @@ public partial class OneOfString : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal OneOfString(string varString) + /// + internal OneOfString(string @string) { - VarString = varString; + String = @string; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string VarString { get; set; } + public string String { get; set; } /// /// Gets or Sets additional properties diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 85e19cd25d2d..ef0c2937c6ce 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -32,20 +32,20 @@ public partial class PolymorphicProperty : IValidatableObject /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(bool varBool) + /// + internal PolymorphicProperty(bool @bool) { - VarBool = varBool; + Bool = @bool; OnCreated(); } /// /// Initializes a new instance of the class. /// - /// - internal PolymorphicProperty(string varString) + /// + internal PolymorphicProperty(string @string) { - VarString = varString; + String = @string; OnCreated(); } @@ -72,14 +72,14 @@ internal PolymorphicProperty(List list) partial void OnCreated(); /// - /// Gets or Sets VarBool + /// Gets or Sets Bool /// - public bool? VarBool { get; set; } + public bool? Bool { get; set; } /// - /// Gets or Sets VarString + /// Gets or Sets String /// - public string VarString { get; set; } + public string String { get; set; } /// /// Gets or Sets Object @@ -159,11 +159,11 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { - Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); - Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; - ClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject);