From 1b36083afd704891ae4e1984d6b14216260c9dad Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 17:40:21 +0800 Subject: [PATCH] fix #2795 --- .../resources/csharp/modelGeneric.mustache | 2 +- ...ith-fake-endpoints-models-for-testing.yaml | 3 +++ .../csharp/SwaggerClient/IO.Swagger.sln | 10 +++---- .../petstore/csharp/SwaggerClient/README.md | 6 ++--- .../csharp/SwaggerClient/docs/Animal.md | 1 + .../petstore/csharp/SwaggerClient/docs/Cat.md | 1 + .../petstore/csharp/SwaggerClient/docs/Dog.md | 1 + .../csharp/SwaggerClient/docs/FakeApi.md | 8 +++--- .../csharp/SwaggerClient/docs/Name.md | 1 + .../IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../src/IO.Swagger/Api/FakeApi.cs | 24 ++++++++--------- .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/Animal.cs | 26 ++++++++++++++++++- .../SwaggerClient/src/IO.Swagger/Model/Cat.cs | 26 ++++++++++++++++++- .../SwaggerClient/src/IO.Swagger/Model/Dog.cs | 26 ++++++++++++++++++- .../src/IO.Swagger/Model/Name.cs | 13 ++++++++++ 16 files changed, 122 insertions(+), 30 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 6c5da5e4f56b..4d4061a29fd4 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -32,7 +32,7 @@ /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. {{/isReadOnly}} {{/vars}} - public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}}) + public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}}) { {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) if ({{name}} == null) diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 54f061483ad3..526738a2efe9 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -818,6 +818,9 @@ definitions: format: int32 property: type: string + 123Number: + type: integer + readOnly: true xml: name: Name 200_response: diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 72e6e04d1211..3c26ad6be492 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{AC0D0300-7030-473F-B672-17C40187815A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{AC0D0300-7030-473F-B672-17C40187815A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{AC0D0300-7030-473F-B672-17C40187815A}.Debug|Any CPU.Build.0 = Debug|Any CPU -{AC0D0300-7030-473F-B672-17C40187815A}.Release|Any CPU.ActiveCfg = Release|Any CPU -{AC0D0300-7030-473F-B672-17C40187815A}.Release|Any CPU.Build.0 = Release|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 1f7e9f634e03..c546b834c182 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-07T17:39:09.181+08:00 +- Build date: 2016-05-10T17:39:13.582+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -69,7 +69,7 @@ namespace Example try { - // Fake endpoint for testing various parameters + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } catch (Exception e) @@ -87,7 +87,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters +*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md b/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md index 46eb96c05f42..f461176159c7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] [[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/SwaggerClient/docs/Cat.md b/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md index e0034d4ab5d0..a88425f4307c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool?** | | [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/SwaggerClient/docs/Dog.md b/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md index 0acf4182d942..c3ee6d927b42 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **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/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index ae9fd8c3d36d..65b04a12ccb0 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters +[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # **TestEndpointParameters** > void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example ```csharp @@ -45,7 +45,7 @@ namespace Example try { - // Fake endpoint for testing various parameters + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } catch (Exception e) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Name.md b/samples/client/petstore/csharp/SwaggerClient/docs/Name.md index 6cb961b6fcf9..678132c8e4e8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Name.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Name.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes **_Name** | **int?** | | **SnakeCase** | **int?** | | [optional] **Property** | **string** | | [optional] +**_123Number** | **int?** | | [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/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index de3b57cfe78f..743b0b978532 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -65,7 +65,7 @@ - {AC0D0300-7030-473F-B672-17C40187815A} + {C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 1c92dc3bbda7..8b9fe2e52c87 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -14,10 +14,10 @@ namespace IO.Swagger.Api { #region Synchronous Operations /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -36,10 +36,10 @@ namespace IO.Swagger.Api void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -59,10 +59,10 @@ namespace IO.Swagger.Api #endregion Synchronous Operations #region Asynchronous Operations /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -81,10 +81,10 @@ namespace IO.Swagger.Api System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -192,7 +192,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -214,7 +214,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -303,7 +303,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -326,7 +326,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 5d9a64329c1e..ad86456eceaa 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {AC0D0300-7030-473F-B672-17C40187815A} + {C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs index f5b9a3efee0f..87a17aa4fae4 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs @@ -21,7 +21,8 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// ClassName (required). - public Animal(string ClassName = null) + /// Color (default to "red"). + public Animal(string ClassName = null, string Color = null) { // to ensure "ClassName" is required (not null) if (ClassName == null) @@ -34,6 +35,16 @@ namespace IO.Swagger.Model } + // use default value if no "Color" provided + if (Color == null) + { + this.Color = "red"; + } + else + { + this.Color = Color; + } + } /// @@ -42,6 +53,11 @@ namespace IO.Swagger.Model [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { get; set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -50,6 +66,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Animal {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); +sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -90,6 +107,11 @@ namespace IO.Swagger.Model this.ClassName == other.ClassName || this.ClassName != null && this.ClassName.Equals(other.ClassName) + ) && + ( + this.Color == other.Color || + this.Color != null && + this.Color.Equals(other.Color) ); } @@ -106,6 +128,8 @@ namespace IO.Swagger.Model // Suitable nullity checks etc, of course :) if (this.ClassName != null) hash = hash * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hash = hash * 59 + this.Color.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs index 74bd81aee05f..fee880c5d823 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs @@ -21,8 +21,9 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// ClassName (required). + /// Color (default to "red"). /// Declawed. - public Cat(string ClassName = null, bool? Declawed = null) + public Cat(string ClassName = null, string Color = null, bool? Declawed = null) { // to ensure "ClassName" is required (not null) if (ClassName == null) @@ -35,6 +36,16 @@ namespace IO.Swagger.Model } + // use default value if no "Color" provided + if (Color == null) + { + this.Color = "red"; + } + else + { + this.Color = Color; + } + this.Declawed = Declawed; } @@ -45,6 +56,11 @@ namespace IO.Swagger.Model [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { get; set; } + /// /// Gets or Sets Declawed /// [DataMember(Name="declawed", EmitDefaultValue=false)] @@ -58,6 +74,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Cat {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); +sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -100,6 +117,11 @@ sb.Append(" Declawed: ").Append(Declawed).Append("\n"); this.ClassName != null && this.ClassName.Equals(other.ClassName) ) && + ( + this.Color == other.Color || + this.Color != null && + this.Color.Equals(other.Color) + ) && ( this.Declawed == other.Declawed || this.Declawed != null && @@ -120,6 +142,8 @@ sb.Append(" Declawed: ").Append(Declawed).Append("\n"); // Suitable nullity checks etc, of course :) if (this.ClassName != null) hash = hash * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hash = hash * 59 + this.Color.GetHashCode(); if (this.Declawed != null) hash = hash * 59 + this.Declawed.GetHashCode(); return hash; diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs index 6ab8c9ad69f1..fb65e3e0c99e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs @@ -21,8 +21,9 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// ClassName (required). + /// Color (default to "red"). /// Breed. - public Dog(string ClassName = null, string Breed = null) + public Dog(string ClassName = null, string Color = null, string Breed = null) { // to ensure "ClassName" is required (not null) if (ClassName == null) @@ -35,6 +36,16 @@ namespace IO.Swagger.Model } + // use default value if no "Color" provided + if (Color == null) + { + this.Color = "red"; + } + else + { + this.Color = Color; + } + this.Breed = Breed; } @@ -45,6 +56,11 @@ namespace IO.Swagger.Model [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { get; set; } + /// /// Gets or Sets Breed /// [DataMember(Name="breed", EmitDefaultValue=false)] @@ -58,6 +74,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Dog {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); +sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -100,6 +117,11 @@ sb.Append(" Breed: ").Append(Breed).Append("\n"); this.ClassName != null && this.ClassName.Equals(other.ClassName) ) && + ( + this.Color == other.Color || + this.Color != null && + this.Color.Equals(other.Color) + ) && ( this.Breed == other.Breed || this.Breed != null && @@ -120,6 +142,8 @@ sb.Append(" Breed: ").Append(Breed).Append("\n"); // Suitable nullity checks etc, of course :) if (this.ClassName != null) hash = hash * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hash = hash * 59 + this.Color.GetHashCode(); if (this.Breed != null) hash = hash * 59 + this.Breed.GetHashCode(); return hash; diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs index b0e819fec201..25273ffb97ba 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs @@ -55,6 +55,11 @@ namespace IO.Swagger.Model [DataMember(Name="property", EmitDefaultValue=false)] public string Property { get; set; } /// + /// Gets or Sets _123Number + /// + [DataMember(Name="123Number", EmitDefaultValue=false)] + public int? _123Number { get; private set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -65,6 +70,7 @@ namespace IO.Swagger.Model sb.Append(" _Name: ").Append(_Name).Append("\n"); sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); sb.Append(" Property: ").Append(Property).Append("\n"); +sb.Append(" _123Number: ").Append(_123Number).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -115,6 +121,11 @@ sb.Append(" Property: ").Append(Property).Append("\n"); this.Property == other.Property || this.Property != null && this.Property.Equals(other.Property) + ) && + ( + this._123Number == other._123Number || + this._123Number != null && + this._123Number.Equals(other._123Number) ); } @@ -135,6 +146,8 @@ sb.Append(" Property: ").Append(Property).Append("\n"); hash = hash * 59 + this.SnakeCase.GetHashCode(); if (this.Property != null) hash = hash * 59 + this.Property.GetHashCode(); + if (this._123Number != null) + hash = hash * 59 + this._123Number.GetHashCode(); return hash; } }