diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index c499088778be..41856daa9ba3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -253,7 +253,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { } if(Boolean.TRUE.equals(generatePropertyChanged)) { - supportingFiles.add(new SupportingFile("FodyWeavers.xml", "", "FodyWeavers.xml")); + supportingFiles.add(new SupportingFile("FodyWeavers.xml", packageFolder, "FodyWeavers.xml")); } supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); diff --git a/modules/swagger-codegen/src/main/resources/csharp/FodyWeavers.xml b/modules/swagger-codegen/src/main/resources/csharp/FodyWeavers.xml index a1637ce893a4..da017fcbf60b 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/FodyWeavers.xml +++ b/modules/swagger-codegen/src/main/resources/csharp/FodyWeavers.xml @@ -1,4 +1,5 @@ + - \ No newline at end of file + diff --git a/modules/swagger-codegen/src/main/resources/csharp/model.mustache b/modules/swagger-codegen/src/main/resources/csharp/model.mustache index 931ba0b63e71..d0fa0a9ff3a7 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model.mustache @@ -9,8 +9,10 @@ using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -{{#generatePropertyChanged}}using PropertyChanged; -using System.ComponentModel;{{/generatePropertyChanged}} +{{#generatePropertyChanged}} +using PropertyChanged; +using System.ComponentModel; +{{/generatePropertyChanged}} {{#models}} {{#model}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index caa4bbbc7dc4..1d3e967b9b08 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -1,8 +1,10 @@ /// /// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} /// - [DataContract]{{#generatePropertyChanged}} - [ImplementPropertyChanged]{{/generatePropertyChanged}} + [DataContract] + {{#generatePropertyChanged}} + [ImplementPropertyChanged] + {{/generatePropertyChanged}} public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}> { {{#vars}} @@ -181,5 +183,6 @@ this.{{name}} = {{name}}; { propertyChanged(this, new PropertyChangedEventArgs(propertyName)); } - }{{/generatePropertyChanged}} + } + {{/generatePropertyChanged}} } diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache index 9ab616089ac4..8f82cb7143c8 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache @@ -2,6 +2,8 @@ - {{#generatePropertyChanged}} - {{/generatePropertyChanged}} + {{#generatePropertyChanged}} + + + {{/generatePropertyChanged}} diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 165302fd0c69..4d0f1b13f158 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", "{497E0E11-BFD7-4CB3-BA32-A19285FBB551}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1F7D41FE-F060-43E8-8866-F14DA42E2A22}" 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,17 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -<<<<<<< HEAD -{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Debug|Any CPU.Build.0 = Debug|Any CPU -{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Release|Any CPU.ActiveCfg = Release|Any CPU -{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Release|Any CPU.Build.0 = Release|Any CPU -======= -{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Debug|Any CPU.Build.0 = Debug|Any CPU -{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Release|Any CPU.ActiveCfg = Release|Any CPU -{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Release|Any CPU.Build.0 = Release|Any CPU ->>>>>>> 3d717bd87491572a1fdca4b146f0666a8f67bccb +{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.Debug|Any CPU.Build.0 = Debug|Any CPU +{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.Release|Any CPU.ActiveCfg = Release|Any CPU +{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.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 @@ -31,4 +24,4 @@ EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 7f89e97f5d94..8b5ee417fbbc 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -138,16 +138,19 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + ### api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header + ### http_basic_test - **Type**: HTTP basic authentication + ### petstore_auth - **Type**: OAuth @@ -157,7 +160,3 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets -### http_basic_test - -- **Type**: HTTP basic authentication - diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/EnumArrays.md b/samples/client/petstore/csharp/SwaggerClient/docs/EnumArrays.md new file mode 100644 index 000000000000..86fd208f8f89 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/EnumArrays.md @@ -0,0 +1,10 @@ +# IO.Swagger.Model.EnumArrays +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | **string** | | [optional] +**ArrayEnum** | **List<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/src/IO.Swagger.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumArraysTests.cs new file mode 100644 index 000000000000..d6961ba49d04 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumArraysTests.cs @@ -0,0 +1,98 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing EnumArrays + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class EnumArraysTests + { + // TODO uncomment below to declare an instance variable for EnumArrays + //private EnumArrays instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of EnumArrays + //instance = new EnumArrays(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of EnumArrays + /// + [Test] + public void EnumArraysInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" EnumArrays + //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumArrays"); + } + + /// + /// Test the property 'JustSymbol' + /// + [Test] + public void JustSymbolTest() + { + // TODO unit test for the property 'JustSymbol' + } + /// + /// Test the property 'ArrayEnum' + /// + [Test] + public void ArrayEnumTest() + { + // TODO unit test for the property 'ArrayEnum' + } + + } + +} 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 ee6eca49a652..b5b9f5db6ad6 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 @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {497E0E11-BFD7-4CB3-BA32-A19285FBB551} + {1F7D41FE-F060-43E8-8866-F14DA42E2A22} Library Properties IO.Swagger @@ -70,13 +70,14 @@ limitations under the License. ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll + + - - + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs new file mode 100644 index 000000000000..a33ee389531f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs @@ -0,0 +1,182 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// EnumArrays + /// + [DataContract] + public partial class EnumArrays : IEquatable + { + /// + /// Gets or Sets JustSymbol + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum JustSymbolEnum + { + + /// + /// Enum GreaterThanOrEqualTo for ">=" + /// + [EnumMember(Value = ">=")] + GreaterThanOrEqualTo, + + /// + /// Enum Dollar for "$" + /// + [EnumMember(Value = "$")] + Dollar + } + + + /// + /// Gets or Sets ArrayEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumEnum + { + + /// + /// Enum Fish for "fish" + /// + [EnumMember(Value = "fish")] + Fish, + + /// + /// Enum Crab for "crab" + /// + [EnumMember(Value = "crab")] + Crab + } + + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } + /// + /// Gets or Sets ArrayEnum + /// + [DataMember(Name="array_enum", EmitDefaultValue=false)] + public List ArrayEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// JustSymbol. + /// ArrayEnum. + public EnumArrays(JustSymbolEnum? JustSymbol = null, List ArrayEnum = null) + { + this.JustSymbol = JustSymbol; + this.ArrayEnum = ArrayEnum; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class EnumArrays {\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as EnumArrays); + } + + /// + /// Returns true if EnumArrays instances are equal + /// + /// Instance of EnumArrays to be compared + /// Boolean + public bool Equals(EnumArrays other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.JustSymbol == other.JustSymbol || + this.JustSymbol != null && + this.JustSymbol.Equals(other.JustSymbol) + ) && + ( + this.ArrayEnum == other.ArrayEnum || + this.ArrayEnum != null && + this.ArrayEnum.SequenceEqual(other.ArrayEnum) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.JustSymbol != null) + hash = hash * 59 + this.JustSymbol.GetHashCode(); + if (this.ArrayEnum != null) + hash = hash * 59 + this.ArrayEnum.GetHashCode(); + return hash; + } + } + } + +}