From d438d797da2b0bfdfc32b10978300c7850af86af Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 23 Mar 2021 20:00:26 +0800 Subject: [PATCH] [C#][netcore] Fix model, property name check (#9049) * fix model, property name check in c# generator * remove file * remove file * specify name --- .../languages/AbstractCSharpCodegen.java | 2 +- ...odels-for-testing-with-http-signature.yaml | 2 ++ .../docs/ModelClient.md | 2 +- .../docs/SpecialModelName.md | 1 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 12 +++---- .../Model/SpecialModelName.cs | 13 ++++++- .../OpenAPIClient-net47/docs/ModelClient.md | 2 +- .../docs/SpecialModelName.md | 1 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 12 +++---- .../Model/SpecialModelName.cs | 13 ++++++- .../OpenAPIClient-net5.0/docs/ModelClient.md | 2 +- .../docs/SpecialModelName.md | 1 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 12 +++---- .../Model/SpecialModelName.cs | 13 ++++++- .../OpenAPIClient/docs/ModelClient.md | 2 +- .../OpenAPIClient/docs/SpecialModelName.md | 1 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 12 +++---- .../Model/SpecialModelName.cs | 13 ++++++- .../OpenAPIClientCore/docs/ModelClient.md | 2 +- .../docs/SpecialModelName.md | 1 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 12 +++---- .../Model/SpecialModelName.cs | 13 ++++++- .../csharp/OpenAPIClient/docs/ModelClient.md | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 18 +++++----- .../java/jersey2-java8/api/openapi.yaml | 2 ++ .../jersey2-java8/docs/SpecialModelName.md | 1 + .../client/model/SpecialModelName.java | 36 +++++++++++++++++-- .../petstore/java/native/api/openapi.yaml | 2 ++ .../java/native/docs/SpecialModelName.md | 1 + .../client/model/SpecialModelName.java | 36 +++++++++++++++++-- 30 files changed, 185 insertions(+), 57 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 0bcdbb3a372..68c9344fe36 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 @@ -399,7 +399,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co // check to see if model name is same as the property name // which will result in compilation error // if found, prepend with _ to workaround the limitation - if (var.name.equalsIgnoreCase(cm.name)) { + if (var.name.equalsIgnoreCase(cm.classname)) { var.name = "_" + var.name; } } diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 843298825ab..05b1c7abd35 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1793,6 +1793,8 @@ components: '$special[property.name]': type: integer format: int64 + '_special_model.name_': + type: string xml: name: '$special[model.name]' HealthCheckResult: diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ModelClient.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ModelClient.md index 8a1bd169a2f..c29a6287433 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ModelClient.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ModelClient.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**__Client** | **string** | | [optional] +**_Client** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/SpecialModelName.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/SpecialModelName.md index a27e685165a..648179799e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/SpecialModelName.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/SpecialModelName.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **long** | | [optional] +**_SpecialModelName** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs index 16f1dc95bab..4ee431a9b2f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ModelClient.cs @@ -38,15 +38,15 @@ namespace Org.OpenAPITools.Model /// _client. public ModelClient(string _client = default(string)) { - this.__Client = _client; + this._Client = _client; this.AdditionalProperties = new Dictionary(); } /// - /// Gets or Sets __Client + /// Gets or Sets _Client /// [DataMember(Name = "client", EmitDefaultValue = false)] - public string __Client { get; set; } + public string _Client { get; set; } /// /// Gets or Sets additional properties @@ -62,7 +62,7 @@ namespace Org.OpenAPITools.Model { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); + sb.Append(" _Client: ").Append(_Client).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -106,8 +106,8 @@ namespace Org.OpenAPITools.Model unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.__Client != null) - hashCode = hashCode * 59 + this.__Client.GetHashCode(); + if (this._Client != null) + hashCode = hashCode * 59 + this._Client.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs index f7199da4c03..26861d98d34 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -36,9 +36,11 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// specialPropertyName. - public SpecialModelName(long specialPropertyName = default(long)) + /// specialModelName. + public SpecialModelName(long specialPropertyName = default(long), string specialModelName = default(string)) { this.SpecialPropertyName = specialPropertyName; + this._SpecialModelName = specialModelName; this.AdditionalProperties = new Dictionary(); } @@ -48,6 +50,12 @@ namespace Org.OpenAPITools.Model [DataMember(Name = "$special[property.name]", EmitDefaultValue = false)] public long SpecialPropertyName { get; set; } + /// + /// Gets or Sets _SpecialModelName + /// + [DataMember(Name = "_special_model.name_", EmitDefaultValue = false)] + public string _SpecialModelName { get; set; } + /// /// Gets or Sets additional properties /// @@ -63,6 +71,7 @@ namespace Org.OpenAPITools.Model var sb = new StringBuilder(); sb.Append("class SpecialModelName {\n"); sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" _SpecialModelName: ").Append(_SpecialModelName).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -107,6 +116,8 @@ namespace Org.OpenAPITools.Model { int hashCode = 41; hashCode = hashCode * 59 + this.SpecialPropertyName.GetHashCode(); + if (this._SpecialModelName != null) + hashCode = hashCode * 59 + this._SpecialModelName.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ModelClient.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ModelClient.md index 8a1bd169a2f..c29a6287433 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ModelClient.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ModelClient.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**__Client** | **string** | | [optional] +**_Client** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/SpecialModelName.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/SpecialModelName.md index a27e685165a..648179799e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/SpecialModelName.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/SpecialModelName.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **long** | | [optional] +**_SpecialModelName** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ModelClient.cs index 16f1dc95bab..4ee431a9b2f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ModelClient.cs @@ -38,15 +38,15 @@ namespace Org.OpenAPITools.Model /// _client. public ModelClient(string _client = default(string)) { - this.__Client = _client; + this._Client = _client; this.AdditionalProperties = new Dictionary(); } /// - /// Gets or Sets __Client + /// Gets or Sets _Client /// [DataMember(Name = "client", EmitDefaultValue = false)] - public string __Client { get; set; } + public string _Client { get; set; } /// /// Gets or Sets additional properties @@ -62,7 +62,7 @@ namespace Org.OpenAPITools.Model { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); + sb.Append(" _Client: ").Append(_Client).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -106,8 +106,8 @@ namespace Org.OpenAPITools.Model unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.__Client != null) - hashCode = hashCode * 59 + this.__Client.GetHashCode(); + if (this._Client != null) + hashCode = hashCode * 59 + this._Client.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SpecialModelName.cs index f7199da4c03..26861d98d34 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -36,9 +36,11 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// specialPropertyName. - public SpecialModelName(long specialPropertyName = default(long)) + /// specialModelName. + public SpecialModelName(long specialPropertyName = default(long), string specialModelName = default(string)) { this.SpecialPropertyName = specialPropertyName; + this._SpecialModelName = specialModelName; this.AdditionalProperties = new Dictionary(); } @@ -48,6 +50,12 @@ namespace Org.OpenAPITools.Model [DataMember(Name = "$special[property.name]", EmitDefaultValue = false)] public long SpecialPropertyName { get; set; } + /// + /// Gets or Sets _SpecialModelName + /// + [DataMember(Name = "_special_model.name_", EmitDefaultValue = false)] + public string _SpecialModelName { get; set; } + /// /// Gets or Sets additional properties /// @@ -63,6 +71,7 @@ namespace Org.OpenAPITools.Model var sb = new StringBuilder(); sb.Append("class SpecialModelName {\n"); sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" _SpecialModelName: ").Append(_SpecialModelName).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -107,6 +116,8 @@ namespace Org.OpenAPITools.Model { int hashCode = 41; hashCode = hashCode * 59 + this.SpecialPropertyName.GetHashCode(); + if (this._SpecialModelName != null) + hashCode = hashCode * 59 + this._SpecialModelName.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ModelClient.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ModelClient.md index 8a1bd169a2f..c29a6287433 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ModelClient.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ModelClient.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**__Client** | **string** | | [optional] +**_Client** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/SpecialModelName.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/SpecialModelName.md index a27e685165a..648179799e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/SpecialModelName.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/SpecialModelName.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **long** | | [optional] +**_SpecialModelName** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ModelClient.cs index 16f1dc95bab..4ee431a9b2f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -38,15 +38,15 @@ namespace Org.OpenAPITools.Model /// _client. public ModelClient(string _client = default(string)) { - this.__Client = _client; + this._Client = _client; this.AdditionalProperties = new Dictionary(); } /// - /// Gets or Sets __Client + /// Gets or Sets _Client /// [DataMember(Name = "client", EmitDefaultValue = false)] - public string __Client { get; set; } + public string _Client { get; set; } /// /// Gets or Sets additional properties @@ -62,7 +62,7 @@ namespace Org.OpenAPITools.Model { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); + sb.Append(" _Client: ").Append(_Client).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -106,8 +106,8 @@ namespace Org.OpenAPITools.Model unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.__Client != null) - hashCode = hashCode * 59 + this.__Client.GetHashCode(); + if (this._Client != null) + hashCode = hashCode * 59 + this._Client.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index f7199da4c03..26861d98d34 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -36,9 +36,11 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// specialPropertyName. - public SpecialModelName(long specialPropertyName = default(long)) + /// specialModelName. + public SpecialModelName(long specialPropertyName = default(long), string specialModelName = default(string)) { this.SpecialPropertyName = specialPropertyName; + this._SpecialModelName = specialModelName; this.AdditionalProperties = new Dictionary(); } @@ -48,6 +50,12 @@ namespace Org.OpenAPITools.Model [DataMember(Name = "$special[property.name]", EmitDefaultValue = false)] public long SpecialPropertyName { get; set; } + /// + /// Gets or Sets _SpecialModelName + /// + [DataMember(Name = "_special_model.name_", EmitDefaultValue = false)] + public string _SpecialModelName { get; set; } + /// /// Gets or Sets additional properties /// @@ -63,6 +71,7 @@ namespace Org.OpenAPITools.Model var sb = new StringBuilder(); sb.Append("class SpecialModelName {\n"); sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" _SpecialModelName: ").Append(_SpecialModelName).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -107,6 +116,8 @@ namespace Org.OpenAPITools.Model { int hashCode = 41; hashCode = hashCode * 59 + this.SpecialPropertyName.GetHashCode(); + if (this._SpecialModelName != null) + hashCode = hashCode * 59 + this._SpecialModelName.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ModelClient.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ModelClient.md index 8a1bd169a2f..c29a6287433 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ModelClient.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ModelClient.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**__Client** | **string** | | [optional] +**_Client** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/SpecialModelName.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/SpecialModelName.md index a27e685165a..648179799e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/SpecialModelName.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/SpecialModelName.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **long** | | [optional] +**_SpecialModelName** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs index 16f1dc95bab..4ee431a9b2f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs @@ -38,15 +38,15 @@ namespace Org.OpenAPITools.Model /// _client. public ModelClient(string _client = default(string)) { - this.__Client = _client; + this._Client = _client; this.AdditionalProperties = new Dictionary(); } /// - /// Gets or Sets __Client + /// Gets or Sets _Client /// [DataMember(Name = "client", EmitDefaultValue = false)] - public string __Client { get; set; } + public string _Client { get; set; } /// /// Gets or Sets additional properties @@ -62,7 +62,7 @@ namespace Org.OpenAPITools.Model { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); + sb.Append(" _Client: ").Append(_Client).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -106,8 +106,8 @@ namespace Org.OpenAPITools.Model unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.__Client != null) - hashCode = hashCode * 59 + this.__Client.GetHashCode(); + if (this._Client != null) + hashCode = hashCode * 59 + this._Client.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SpecialModelName.cs index f7199da4c03..26861d98d34 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -36,9 +36,11 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// specialPropertyName. - public SpecialModelName(long specialPropertyName = default(long)) + /// specialModelName. + public SpecialModelName(long specialPropertyName = default(long), string specialModelName = default(string)) { this.SpecialPropertyName = specialPropertyName; + this._SpecialModelName = specialModelName; this.AdditionalProperties = new Dictionary(); } @@ -48,6 +50,12 @@ namespace Org.OpenAPITools.Model [DataMember(Name = "$special[property.name]", EmitDefaultValue = false)] public long SpecialPropertyName { get; set; } + /// + /// Gets or Sets _SpecialModelName + /// + [DataMember(Name = "_special_model.name_", EmitDefaultValue = false)] + public string _SpecialModelName { get; set; } + /// /// Gets or Sets additional properties /// @@ -63,6 +71,7 @@ namespace Org.OpenAPITools.Model var sb = new StringBuilder(); sb.Append("class SpecialModelName {\n"); sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" _SpecialModelName: ").Append(_SpecialModelName).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -107,6 +116,8 @@ namespace Org.OpenAPITools.Model { int hashCode = 41; hashCode = hashCode * 59 + this.SpecialPropertyName.GetHashCode(); + if (this._SpecialModelName != null) + hashCode = hashCode * 59 + this._SpecialModelName.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ModelClient.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ModelClient.md index 8a1bd169a2f..c29a6287433 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ModelClient.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ModelClient.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**__Client** | **string** | | [optional] +**_Client** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/SpecialModelName.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/SpecialModelName.md index a27e685165a..648179799e1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/SpecialModelName.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/SpecialModelName.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **long** | | [optional] +**_SpecialModelName** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs index 09257478b56..45be979525c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -38,14 +38,14 @@ namespace Org.OpenAPITools.Model /// _client. public ModelClient(string _client = default(string)) { - this.__Client = _client; + this._Client = _client; } /// - /// Gets or Sets __Client + /// Gets or Sets _Client /// [DataMember(Name = "client", EmitDefaultValue = false)] - public string __Client { get; set; } + public string _Client { get; set; } /// /// Returns the string presentation of the object @@ -55,7 +55,7 @@ namespace Org.OpenAPITools.Model { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); + sb.Append(" _Client: ").Append(_Client).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -98,8 +98,8 @@ namespace Org.OpenAPITools.Model unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.__Client != null) - hashCode = hashCode * 59 + this.__Client.GetHashCode(); + if (this._Client != null) + hashCode = hashCode * 59 + this._Client.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs index c467ab0c57d..7f69f554b46 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -36,9 +36,11 @@ namespace Org.OpenAPITools.Model /// Initializes a new instance of the class. /// /// specialPropertyName. - public SpecialModelName(long specialPropertyName = default(long)) + /// specialModelName. + public SpecialModelName(long specialPropertyName = default(long), string specialModelName = default(string)) { this.SpecialPropertyName = specialPropertyName; + this._SpecialModelName = specialModelName; } /// @@ -47,6 +49,12 @@ namespace Org.OpenAPITools.Model [DataMember(Name = "$special[property.name]", EmitDefaultValue = false)] public long SpecialPropertyName { get; set; } + /// + /// Gets or Sets _SpecialModelName + /// + [DataMember(Name = "_special_model.name_", EmitDefaultValue = false)] + public string _SpecialModelName { get; set; } + /// /// Returns the string presentation of the object /// @@ -56,6 +64,7 @@ namespace Org.OpenAPITools.Model var sb = new StringBuilder(); sb.Append("class SpecialModelName {\n"); sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" _SpecialModelName: ").Append(_SpecialModelName).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -99,6 +108,8 @@ namespace Org.OpenAPITools.Model { int hashCode = 41; hashCode = hashCode * 59 + this.SpecialPropertyName.GetHashCode(); + if (this._SpecialModelName != null) + hashCode = hashCode * 59 + this._SpecialModelName.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/ModelClient.md b/samples/client/petstore/csharp/OpenAPIClient/docs/ModelClient.md index e36e1fad802..80bd5d6edba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/ModelClient.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/ModelClient.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**__Client** | **string** | | [optional] +**_Client** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs index 15d88accfdc..9c1e8a26e5c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/ModelClient.cs @@ -36,14 +36,14 @@ namespace Org.OpenAPITools.Model /// _client. public ModelClient(string _client = default(string)) { - this.__Client = _client; + this._Client = _client; } /// - /// Gets or Sets __Client + /// Gets or Sets _Client /// [DataMember(Name="client", EmitDefaultValue=false)] - public string __Client { get; set; } + public string _Client { get; set; } /// /// Returns the string presentation of the object @@ -53,7 +53,7 @@ namespace Org.OpenAPITools.Model { var sb = new StringBuilder(); sb.Append("class ModelClient {\n"); - sb.Append(" __Client: ").Append(__Client).Append("\n"); + sb.Append(" _Client: ").Append(_Client).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -89,9 +89,9 @@ namespace Org.OpenAPITools.Model return ( - this.__Client == input.__Client || - (this.__Client != null && - this.__Client.Equals(input.__Client)) + this._Client == input._Client || + (this._Client != null && + this._Client.Equals(input._Client)) ); } @@ -104,8 +104,8 @@ namespace Org.OpenAPITools.Model unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.__Client != null) - hashCode = hashCode * 59 + this.__Client.GetHashCode(); + if (this._Client != null) + hashCode = hashCode * 59 + this._Client.GetHashCode(); return hashCode; } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml index 1e5c6be79a3..0ef965969a7 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -1957,6 +1957,8 @@ components: $special[property.name]: format: int64 type: integer + _special_model.name_: + type: string xml: name: $special[model.name] HealthCheckResult: diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/SpecialModelName.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/SpecialModelName.md index 2692c1caafe..352611142df 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/SpecialModelName.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **$specialPropertyName** | **Long** | | [optional] +**specialModelName** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java index f72fc3538e2..3adc9c06ff3 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -32,13 +32,17 @@ import org.openapitools.client.JSON; * SpecialModelName */ @JsonPropertyOrder({ - SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, + SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SpecialModelName { public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; private Long $specialPropertyName; + public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_"; + private String specialModelName; + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -64,6 +68,30 @@ public class SpecialModelName { } + public SpecialModelName specialModelName(String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSpecialModelName() { + return specialModelName; + } + + + public void setSpecialModelName(String specialModelName) { + this.specialModelName = specialModelName; + } + + /** * Return true if this _special_model.name_ object is equal to o. */ @@ -76,12 +104,13 @@ public class SpecialModelName { return false; } SpecialModelName specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName) && + Objects.equals(this.specialModelName, specialModelName.specialModelName); } @Override public int hashCode() { - return Objects.hash($specialPropertyName); + return Objects.hash($specialPropertyName, specialModelName); } @Override @@ -89,6 +118,7 @@ public class SpecialModelName { StringBuilder sb = new StringBuilder(); sb.append("class SpecialModelName {\n"); sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/native/api/openapi.yaml b/samples/openapi3/client/petstore/java/native/api/openapi.yaml index 1e5c6be79a3..0ef965969a7 100644 --- a/samples/openapi3/client/petstore/java/native/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/native/api/openapi.yaml @@ -1957,6 +1957,8 @@ components: $special[property.name]: format: int64 type: integer + _special_model.name_: + type: string xml: name: $special[model.name] HealthCheckResult: diff --git a/samples/openapi3/client/petstore/java/native/docs/SpecialModelName.md b/samples/openapi3/client/petstore/java/native/docs/SpecialModelName.md index 2692c1caafe..352611142df 100644 --- a/samples/openapi3/client/petstore/java/native/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/java/native/docs/SpecialModelName.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **$specialPropertyName** | **Long** | | [optional] +**specialModelName** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/openapi3/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java index 9d3397e2241..cabc24f175a 100644 --- a/samples/openapi3/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/openapi3/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,13 +31,17 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; * SpecialModelName */ @JsonPropertyOrder({ - SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, + SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME }) @javax.annotation.processing.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SpecialModelName { public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; private Long $specialPropertyName; + public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_"; + private String specialModelName; + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -63,6 +67,30 @@ public class SpecialModelName { } + public SpecialModelName specialModelName(String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSpecialModelName() { + return specialModelName; + } + + + public void setSpecialModelName(String specialModelName) { + this.specialModelName = specialModelName; + } + + /** * Return true if this _special_model.name_ object is equal to o. */ @@ -75,12 +103,13 @@ public class SpecialModelName { return false; } SpecialModelName specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName) && + Objects.equals(this.specialModelName, specialModelName.specialModelName); } @Override public int hashCode() { - return Objects.hash($specialPropertyName); + return Objects.hash($specialPropertyName, specialModelName); } @Override @@ -88,6 +117,7 @@ public class SpecialModelName { StringBuilder sb = new StringBuilder(); sb.append("class SpecialModelName {\n"); sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n"); sb.append("}"); return sb.toString(); }