diff --git a/bin/windows/csharp-petstore-all.bat b/bin/windows/csharp-petstore-all.bat index f68f9283e623..04e79076ba3c 100755 --- a/bin/windows/csharp-petstore-all.bat +++ b/bin/windows/csharp-petstore-all.bat @@ -11,4 +11,6 @@ call .\bin\windows\csharp-dotnet2-petstore.bat call .\bin\windows\csharp-petstore-netcore-project.bat -call .\bin\windows\csharp-property-changed-petstore.bat \ No newline at end of file +call .\bin\windows\csharp-property-changed-petstore.bat + +call .\bin\windows\csharp-petstore-net-40.bat \ No newline at end of file diff --git a/bin/windows/csharp-petstore-net-40.bat b/bin/windows/csharp-petstore-net-40.bat new file mode 100644 index 000000000000..113b2efd9877 --- /dev/null +++ b/bin/windows/csharp-petstore-net-40.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M +set ags=generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-40.json + +java %JAVA_OPTS% -jar %executable% %ags% 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 fbfad38f5db6..ec212afeb5b3 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 @@ -359,8 +359,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { clientPackageDir, "ExceptionFactory.cs")); supportingFiles.add(new SupportingFile("SwaggerDateConverter.mustache", clientPackageDir, "SwaggerDateConverter.cs")); - supportingFiles.add(new SupportingFile("JsonSubTypes.mustache", - clientPackageDir, "JsonSubTypes.cs")); if (NET40.equals(this.targetFramework)) { // .net 4.0 doesn't include ReadOnlyDictionary… diff --git a/modules/swagger-codegen/src/main/resources/aspnetcore/project.json.mustache b/modules/swagger-codegen/src/main/resources/aspnetcore/project.json.mustache index e415d80d7282..9392bf92231c 100644 --- a/modules/swagger-codegen/src/main/resources/aspnetcore/project.json.mustache +++ b/modules/swagger-codegen/src/main/resources/aspnetcore/project.json.mustache @@ -22,7 +22,8 @@ "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", "Microsoft.EntityFrameworkCore": "1.0.0", "Swashbuckle.AspNetCore": "1.0.0-rc3", - "Newtonsoft.Json": "9.0.1" + "Newtonsoft.Json": "10.0.3", + "JsonSubTypes": "1.1.3" }, "tools": { diff --git a/modules/swagger-codegen/src/main/resources/csharp/JsonSubTypes.mustache b/modules/swagger-codegen/src/main/resources/csharp/JsonSubTypes.mustache deleted file mode 100644 index 90ddf3a22285..000000000000 --- a/modules/swagger-codegen/src/main/resources/csharp/JsonSubTypes.mustache +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType{{^isNet40}}.GetTypeInfo(){{/isNet40}}.IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer{{#isNet40}}.GetGenericArguments().FirstOrDefault(){{/isNet40}}{{^isNet40}}.GenericTypeArguments[0]{{/isNet40}}; - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType{{#isNet40}}.GetCustomAttributes(false).OfType{{/isNet40}}{{^isNet40}}.GetTypeInfo().GetCustomAttributes{{/isNet40}}()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType{{^isNet40}}.GetTypeInfo(){{/isNet40}}.Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(I{{^isNet40}}ReadOnly{{/isNet40}}Dictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type{{#isNet40}}.GetCustomAttributes(false).OfType{{/isNet40}}{{^isNet40}}.GetTypeInfo().GetCustomAttributes{{/isNet40}}().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType{{^isNet40}}.GetTypeInfo(){{/isNet40}}.IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} diff --git a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache index 84afceae190d..d9fde4d8432f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache @@ -72,6 +72,12 @@ ..\..\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll {{binRelativePath}}\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + {{binRelativePath}}\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/README.mustache b/modules/swagger-codegen/src/main/resources/csharp/README.mustache index 80e24376947b..be9091f80ad2 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/README.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/README.mustache @@ -39,7 +39,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c {{#netStandard}} - FubarCoder.RestSharp.Portable.Core >=4.0.7 - FubarCoder.RestSharp.Portable.HttpClient >=4.0.7 -- Newtonsoft.Json >=9.0.1 +- Newtonsoft.Json >=10.0.3 {{/netStandard}} {{^netStandard}} - [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later diff --git a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache index eee304c33683..c88a8905c487 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache @@ -64,6 +64,12 @@ ..\..\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll {{binRelativePath}}\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + {{binRelativePath}}\JsonSubTypes.1.1.3\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/netcore_project.mustache b/modules/swagger-codegen/src/main/resources/csharp/netcore_project.mustache index 85b6fe000de3..9fa3461bade7 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/netcore_project.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/netcore_project.mustache @@ -25,7 +25,8 @@ {{^netStandard}} {{/netStandard}} - + + {{^netStandard}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/netcore_testproject.mustache b/modules/swagger-codegen/src/main/resources/csharp/netcore_testproject.mustache index c365a217ffa8..33d4a61b9434 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/netcore_testproject.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/netcore_testproject.mustache @@ -24,7 +24,8 @@ {{^netStandard}} {{/netStandard}} - + + {{^netStandard}} 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 e4c40355533b..9f03903dce68 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,7 @@ + {{#generatePropertyChanged}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache index 661dbac94c09..b401079b1d6c 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache @@ -3,4 +3,5 @@ + diff --git a/modules/swagger-codegen/src/main/resources/csharp/project.json.mustache b/modules/swagger-codegen/src/main/resources/csharp/project.json.mustache index 0107fc3a621a..dea5442ac025 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/project.json.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/project.json.mustache @@ -3,7 +3,8 @@ "dependencies": { "FubarCoder.RestSharp.Portable.Core": "4.0.7", "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", - "Newtonsoft.Json": "9.0.1" + "Newtonsoft.Json": "10.0.3", + "JsonSubTypes": "1.1.3" }, "frameworks": { "{{targetFrameworkNuget}}": {} diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore b/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore index d3f4f7b6f551..17302c93bf09 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore @@ -6,6 +6,7 @@ *.suo *.user *.sln.docstates +./nuget # Build results diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/IO.Swagger.userprefs b/samples/client/petstore-security-test/csharp/SwaggerClient/IO.Swagger.userprefs deleted file mode 100644 index eaf83ecaeae3..000000000000 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/IO.Swagger.userprefs +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/LICENSE b/samples/client/petstore-security-test/csharp/SwaggerClient/LICENSE deleted file mode 100644 index 8dada3edaf50..000000000000 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh b/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh index ce37b66b21c7..4892f3c07ea8 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh @@ -4,14 +4,43 @@ # frameworkVersion=net45 -netfx=${frameworkVersion#net} + +# sdk must match installed framworks under PREFIX/lib/mono/[value] +sdk=4.5.2-api + +# langversion refers to C# language features. see man mcs for details. +langversion=${sdk} +nuget_cmd=nuget + +# Match against our known SDK possibilities +case "${sdk}" in + 4) + langversion=4 + ;; + 4.5*) + langversion=5 + ;; + 4.6*) + langversion=6 + ;; + 4.7*) + langversion=7 # ignoring 7.1 for now. + ;; + *) + langversion=6 + ;; +esac echo "[INFO] Target framework: ${frameworkVersion}" -echo "[INFO] Download nuget and packages" -wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe; +if [ ! type nuget &>/dev/null ]; then + echo "[INFO] Download nuget and packages" + wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe; + nuget_cmd="mono nuget" +fi + mozroots --import --sync -mono nuget.exe install src/IO.Swagger/packages.config -o packages; +${nuget_cmd} install src/IO.Swagger/packages.config -o packages; echo "[INFO] Copy DLLs to the 'bin' folder" mkdir -p bin; @@ -19,7 +48,7 @@ cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft. cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll" -mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ +mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,\ bin/RestSharp.dll,\ System.ComponentModel.DataAnnotations.dll,\ System.Runtime.Serialization.dll \ diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/git_push.sh b/samples/client/petstore-security-test/csharp/SwaggerClient/git_push.sh index 792320114fbe..160f6f213999 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/git_push.sh +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs index 3bcf1cce2235..145c6ec00f2c 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -1,23 +1,11 @@ /* - * Swagger Petstore ' \" =end + * Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - - * - * OpenAPI spec version: 1.0.0 ' \" =end - * Contact: apiteam@swagger.io ' \" =end + * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * 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; @@ -70,20 +58,20 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - // test 'IsInstanceOfType' FakeApi - Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi"); + // TODO uncomment below to test 'IsInstanceOfType' FakeApi + //Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi"); } /// - /// Test TestCodeInjectEnd + /// Test TestCodeInjectEndRnNR /// [Test] - public void TestCodeInjectEndTest() + public void TestCodeInjectEndRnNRTest() { // TODO uncomment below to test the method and replace null with proper value - //string testCodeInjectEnd = null; - //instance.TestCodeInjectEnd(testCodeInjectEnd); + //string testCodeInjectEndRnNR = null; + //instance.TestCodeInjectEndRnNR(testCodeInjectEndRnNR); } diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index d8744c98f6ab..596b94b087d0 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -52,6 +52,12 @@ Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs index 5a2043e13445..f3e7533c70a7 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs @@ -1,23 +1,11 @@ /* - * Swagger Petstore ' \" =end + * Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - - * - * OpenAPI spec version: 1.0.0 ' \" =end - * Contact: apiteam@swagger.io ' \" =end + * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelReturn"); } + /// /// Test the property '_Return' /// diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config index 105b8298a455..a5a85c7294c6 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config @@ -3,4 +3,5 @@ + diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/JsonSubTypes.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/JsonSubTypes.cs deleted file mode 100644 index 3a6da091b781..000000000000 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/JsonSubTypes.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer.GenericTypeArguments[0]; - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType.GetTypeInfo().GetCustomAttributes()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType.GetTypeInfo().Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(IReadOnlyDictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type.GetTypeInfo().GetCustomAttributes().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType.GetTypeInfo().IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 738c75957765..27cd15d9106d 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -53,6 +53,12 @@ Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/packages.config b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/packages.config index 351ef133ee8c..76a7cbd76d71 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/packages.config +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/packages.config @@ -2,4 +2,5 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterBoolean.md b/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterBoolean.md deleted file mode 100644 index 84845b35e545..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterBoolean.md +++ /dev/null @@ -1,8 +0,0 @@ -# IO.Swagger.Model.OuterBoolean -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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.v5/docs/OuterComposite.md b/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterComposite.md deleted file mode 100644 index 41fae66f1363..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterComposite.md +++ /dev/null @@ -1,11 +0,0 @@ -# IO.Swagger.Model.OuterComposite -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] -**MyString** | [**OuterString**](OuterString.md) | | [optional] -**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [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.v5/docs/OuterNumber.md b/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterNumber.md deleted file mode 100644 index 7c88274d6ee8..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterNumber.md +++ /dev/null @@ -1,8 +0,0 @@ -# IO.Swagger.Model.OuterNumber -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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.v5/docs/OuterString.md b/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterString.md deleted file mode 100644 index 524423a5dab2..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient.v5/docs/OuterString.md +++ /dev/null @@ -1,8 +0,0 @@ -# IO.Swagger.Model.OuterString -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/.swagger-codegen-ignore b/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore index 7a6a67e36ccf..c5fa491b4c55 100644 --- a/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore +++ b/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore @@ -21,4 +21,3 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md -src/IO.Swagger.Test/IO.Swagger.Test.csproj diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md index a4371a966956..5b38bb5b3a58 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **EnumString** | **string** | | [optional] **EnumInteger** | **int?** | | [optional] **EnumNumber** | **double?** | | [optional] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**OuterEnum** | **OuterEnum** | | [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/PropertyType.md b/samples/client/petstore/csharp/SwaggerClient/docs/PropertyType.md deleted file mode 100644 index c99221363d21..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient/docs/PropertyType.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.PropertyType -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Type** | **decimal?** | | [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/git_push.sh b/samples/client/petstore/csharp/SwaggerClient/git_push.sh index 792320114fbe..160f6f213999 100644 --- a/samples/client/petstore/csharp/SwaggerClient/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClient/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs index 283eec5a1450..fc21272e659a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -6,18 +6,6 @@ * 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; @@ -76,6 +64,54 @@ namespace IO.Swagger.Test } + /// + /// Test FakeOuterBooleanSerialize + /// + [Test] + public void FakeOuterBooleanSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterBoolean body = null; + //var response = instance.FakeOuterBooleanSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterBoolean"); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Test] + public void FakeOuterCompositeSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterComposite body = null; + //var response = instance.FakeOuterCompositeSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterComposite"); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Test] + public void FakeOuterNumberSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterNumber body = null; + //var response = instance.FakeOuterNumberSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterNumber"); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Test] + public void FakeOuterStringSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterString body = null; + //var response = instance.FakeOuterStringSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterString"); + } + /// /// Test TestClientModel /// @@ -97,31 +133,63 @@ namespace IO.Swagger.Test // TODO uncomment below to test the method and replace null with proper value //decimal? number = null; //double? _double = null; - //string _string = null; + //string patternWithoutDelimiter = null; //byte[] _byte = null; //int? integer = null; //int? int32 = null; //long? int64 = null; //float? _float = null; + //string _string = null; //byte[] binary = null; //DateTime? date = null; //DateTime? dateTime = null; //string password = null; - //instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + //string callback = null; + //instance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } /// - /// Test TestEnumQueryParameters + /// Test TestEnumParameters /// [Test] - public void TestEnumQueryParametersTest() + public void TestEnumParametersTest() { // TODO uncomment below to test the method and replace null with proper value + //List enumFormStringArray = null; + //string enumFormString = null; + //List enumHeaderStringArray = null; + //string enumHeaderString = null; + //List enumQueryStringArray = null; //string enumQueryString = null; - //decimal? enumQueryInteger = null; + //int? enumQueryInteger = null; //double? enumQueryDouble = null; - //instance.TestEnumQueryParameters(enumQueryString, enumQueryInteger, enumQueryDouble); + //instance.TestEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); + + } + + /// + /// Test TestInlineAdditionalProperties + /// + [Test] + public void TestInlineAdditionalPropertiesTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Object param = null; + //instance.TestInlineAdditionalProperties(param); + + } + + /// + /// Test TestJsonFormData + /// + [Test] + public void TestJsonFormDataTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string param = null; + //string param2 = null; + //instance.TestJsonFormData(param, param2); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs deleted file mode 100644 index 2b08417f7db8..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 - */ - -using System; -using System.IO; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using RestSharp; -using NUnit.Framework; - -using IO.Swagger.Client; -using IO.Swagger.Api; -using IO.Swagger.Model; - -namespace IO.Swagger.Test -{ - /// - /// Class for testing Fake_classname_tags123Api - /// - /// - /// This file is automatically generated by Swagger Codegen. - /// Please update the test case below to test the API endpoint. - /// - [TestFixture] - public class Fake_classname_tags123ApiTests - { - private Fake_classname_tags123Api instance; - - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() - { - instance = new Fake_classname_tags123Api(); - } - - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - - /// - /// Test an instance of Fake_classname_tags123Api - /// - [Test] - public void InstanceTest() - { - // TODO uncomment below to test 'IsInstanceOfType' Fake_classname_tags123Api - //Assert.IsInstanceOfType(typeof(Fake_classname_tags123Api), instance, "instance is a Fake_classname_tags123Api"); - } - - - /// - /// Test TestClassname - /// - [Test] - public void TestClassnameTest() - { - // TODO uncomment below to test the method and replace null with proper value - //ModelClient body = null; - //var response = instance.TestClassname(body); - //Assert.IsInstanceOf (response, "response is ModelClient"); - } - - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs index 37f6cb91a351..34c1fb71f44c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs @@ -1,3 +1,13 @@ +/* + * 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 + */ + using System; using System.IO; using System.Collections.Generic; @@ -25,45 +35,6 @@ namespace IO.Swagger.Test { private PetApi instance; - private long petId = 11088; - - /// - /// Create a Pet object - /// - private Pet createPet() - { - // create pet - Pet p = new Pet(Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); - p.Id = petId; - //p.Name = "Csharp test"; - p.Status = Pet.StatusEnum.Available; - // create Category object - Category category = new Category(); - category.Id = 56; - category.Name = "sample category name2"; - List photoUrls = new List(new String[] {"sample photoUrls"}); - // create Tag object - Tag tag = new Tag(); - tag.Id = petId; - tag.Name = "csharp sample tag name1"; - List tags = new List(new Tag[] {tag}); - p.Tags = tags; - p.Category = category; - p.PhotoUrls = photoUrls; - - return p; - } - - /// - /// Convert string to byte array - /// - private byte[] GetBytes(string str) - { - byte[] bytes = new byte[str.Length * sizeof(char)]; - System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); - return bytes; - } - /// /// Setup before each unit test /// @@ -71,13 +42,6 @@ namespace IO.Swagger.Test public void Init() { instance = new PetApi(); - - // create pet - Pet p = createPet(); - - // add pet before testing - PetApi petApi = new PetApi("http://petstore.swagger.io/v2/"); - petApi.AddPet (p); } /// @@ -86,9 +50,7 @@ namespace IO.Swagger.Test [TearDown] public void Cleanup() { - // remove the pet after testing - PetApi petApi = new PetApi (); - petApi.DeletePet(petId, "test key"); + } /// @@ -97,7 +59,8 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOf(instance); + // TODO uncomment below to test 'IsInstanceOfType' PetApi + //Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi"); } @@ -107,9 +70,10 @@ namespace IO.Swagger.Test [Test] public void AddPetTest() { - // create pet - Pet p = createPet(); - instance.AddPet(p); + // TODO uncomment below to test the method and replace null with proper value + //Pet body = null; + //instance.AddPet(body); + } /// @@ -118,7 +82,11 @@ namespace IO.Swagger.Test [Test] public void DeletePetTest() { - // no need to test as it'c covered by Cleanup() already + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //string apiKey = null; + //instance.DeletePet(petId, apiKey); + } /// @@ -127,15 +95,10 @@ namespace IO.Swagger.Test [Test] public void FindPetsByStatusTest() { - PetApi petApi = new PetApi (); - List tagsList = new List(new String[] {"available"}); - - List listPet = petApi.FindPetsByTags (tagsList); - foreach (Pet pet in listPet) // Loop through List with foreach. - { - Assert.IsInstanceOf(pet); - Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]); - } + // TODO uncomment below to test the method and replace null with proper value + //List status = null; + //var response = instance.FindPetsByStatus(status); + //Assert.IsInstanceOf> (response, "response is List"); } /// @@ -144,9 +107,10 @@ namespace IO.Swagger.Test [Test] public void FindPetsByTagsTest() { - List tags = new List(new String[] {"pet"}); - var response = instance.FindPetsByTags(tags); - Assert.IsInstanceOf>(response); + // TODO uncomment below to test the method and replace null with proper value + //List tags = null; + //var response = instance.FindPetsByTags(tags); + //Assert.IsInstanceOf> (response, "response is List"); } /// @@ -155,96 +119,22 @@ namespace IO.Swagger.Test [Test] public void GetPetByIdTest() { - // set timeout to 10 seconds - Configuration c1 = new Configuration(); - c1.Timeout = 10000; - c1.UserAgent = "TEST_USER_AGENT"; - - PetApi petApi = new PetApi (c1); - Pet response = petApi.GetPetById (petId); - Assert.IsInstanceOf(response); - - Assert.AreEqual ("Csharp test", response.Name); - Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - - Assert.IsInstanceOf>(response.Tags); - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - - Assert.IsInstanceOf>(response.PhotoUrls); - Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - - Assert.IsInstanceOf(response.Category); - Assert.AreEqual (56, response.Category.Id); - Assert.AreEqual ("sample category name2", response.Category.Name); + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //var response = instance.GetPetById(petId); + //Assert.IsInstanceOf (response, "response is Pet"); } - - /// - /// Test GetPetByIdAsync - /// - [Test ()] - public void TestGetPetByIdAsync () - { - PetApi petApi = new PetApi (); - var task = petApi.GetPetByIdAsync (petId); - Pet response = task.Result; - Assert.IsInstanceOf(response); - - Assert.AreEqual ("Csharp test", response.Name); - Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - - Assert.IsInstanceOf>(response.Tags); - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - - Assert.IsInstanceOf>(response.PhotoUrls); - Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - - Assert.IsInstanceOf(response.Category); - Assert.AreEqual (56, response.Category.Id); - Assert.AreEqual ("sample category name2", response.Category.Name); - } - /// - /// Test GetPetByIdAsyncWithHttpInfo - /// - [Test ()] - public void TestGetPetByIdAsyncWithHttpInfo () - { - PetApi petApi = new PetApi (); - var task = petApi.GetPetByIdAsyncWithHttpInfo (petId); - - Assert.AreEqual (200, task.Result.StatusCode); - Assert.IsTrue (task.Result.Headers.ContainsKey("Content-Type")); - Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json"); - - Pet response = task.Result.Data; - Assert.IsInstanceOf(response); - - Assert.AreEqual ("Csharp test", response.Name); - Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - - Assert.IsInstanceOf>(response.Tags); - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - - Assert.IsInstanceOf>(response.PhotoUrls); - Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - - Assert.IsInstanceOf(response.Category); - Assert.AreEqual (56, response.Category.Id); - Assert.AreEqual ("sample category name2", response.Category.Name); - } - /// /// Test UpdatePet /// [Test] public void UpdatePetTest() { - // create pet - Pet p = createPet(); - instance.UpdatePet(p); + // TODO uncomment below to test the method and replace null with proper value + //Pet body = null; + //instance.UpdatePet(body); + } /// @@ -253,24 +143,12 @@ namespace IO.Swagger.Test [Test] public void UpdatePetWithFormTest() { - PetApi petApi = new PetApi(); - petApi.UpdatePetWithForm (petId, "new form name", "pending"); - - Pet response = petApi.GetPetById (petId); - Assert.IsInstanceOf(response); - Assert.IsInstanceOf(response.Category); - Assert.IsInstanceOf>(response.Tags); - - Assert.AreEqual ("new form name", response.Name); - Assert.AreEqual (Pet.StatusEnum.Pending, response.Status); - - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual (56, response.Category.Id); - - // test optional parameter - petApi.UpdatePetWithForm (petId, "new form name2"); - Pet response2 = petApi.GetPetById (petId); - Assert.AreEqual ("new form name2", response2.Name); + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //string name = null; + //string status = null; + //instance.UpdatePetWithForm(petId, name, status); + } /// @@ -279,45 +157,13 @@ namespace IO.Swagger.Test [Test] public void UploadFileTest() { - Assembly _assembly = Assembly.GetExecutingAssembly(); - Stream _imageStream = _assembly.GetManifestResourceStream("IO.Swagger.Test.swagger-logo.png"); - PetApi petApi = new PetApi (); - // test file upload with form parameters - petApi.UploadFile(petId, "new form name", _imageStream); - - // test file upload without any form parameters - // using optional parameter syntax introduced at .net 4.0 - petApi.UploadFile(petId: petId, file: _imageStream); - + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //string additionalMetadata = null; + //System.IO.Stream file = null; + //var response = instance.UploadFile(petId, additionalMetadata, file); + //Assert.IsInstanceOf (response, "response is ApiResponse"); } - - /// - /// Test status code - /// - [Test ()] - public void TestStatusCodeAndHeader () - { - PetApi petApi = new PetApi (); - var response = petApi.GetPetByIdWithHttpInfo (petId); - Assert.AreEqual (response.StatusCode, 200); - Assert.IsTrue (response.Headers.ContainsKey("Content-Type")); - Assert.AreEqual (response.Headers["Content-Type"], "application/json"); - } - - /// - /// Test default header (should be deprecated - /// - [Test ()] - public void TestDefaultHeader () - { - PetApi petApi = new PetApi (); - // commented out the warning test below as it's confirmed the warning is working as expected - // there should be a warning for using AddDefaultHeader (deprecated) below - //petApi.AddDefaultHeader ("header_key", "header_value"); - // the following should be used instead as suggested in the doc - petApi.Configuration.AddDefaultHeader ("header_key2", "header_value2"); - - } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs index b7de1d862dcf..005bf9f0315c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs @@ -6,18 +6,6 @@ * 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; diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs index ff5fdf17ad82..e119bb85c226 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs @@ -6,18 +6,6 @@ * 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; diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs deleted file mode 100644 index 8f7c10d5e438..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs +++ /dev/null @@ -1,128 +0,0 @@ -using NUnit.Framework; -using System; -using System.Collections.Generic; -using IO.Swagger.Client; -using IO.Swagger.Api; -using IO.Swagger.Model; - -namespace IO.Swagger.Test -{ - public class ApiClientTests - { - public ApiClientTests () - { - } - - [SetUp()] - public void BeforeEach() - { - var config = new GlobalConfiguration(); - Configuration.Default = config; - } - - [TearDown()] - public void TearDown() - { - // Reset to default, just in case - Configuration.Default.DateTimeFormat = "o"; - } - - /// - /// Test SelectHeaderContentType - /// - [Test ()] - public void TestSelectHeaderContentType () - { - ApiClient api = new ApiClient (); - String[] contentTypes = new String[] { "application/json", "application/xml" }; - Assert.AreEqual("application/json", api.SelectHeaderContentType (contentTypes)); - - contentTypes = new String[] { "application/xml" }; - Assert.AreEqual("application/xml", api.SelectHeaderContentType (contentTypes)); - - contentTypes = new String[] {}; - Assert.AreEqual("application/json", api.SelectHeaderContentType (contentTypes)); - } - - /// - /// Test ParameterToString - /// - [Test ()] - public void TestParameterToString () - { - ApiClient api = new ApiClient (); - - // test array of string - List statusList = new List(new String[] {"available", "sold"}); - Assert.AreEqual("available,sold", api.ParameterToString (statusList)); - - // test array of int - List numList = new List(new int[] {1, 37}); - Assert.AreEqual("1,37", api.ParameterToString (numList)); - } - - [Test ()] - public void TestParameterToStringForDateTime () - { - ApiClient api = new ApiClient (); - - // test datetime - DateTime dateUtc = DateTime.Parse ("2008-04-10T13:30:00.0000000z", null, System.Globalization.DateTimeStyles.RoundtripKind); - Assert.AreEqual ("2008-04-10T13:30:00.0000000Z", api.ParameterToString (dateUtc)); - - // test datetime with no timezone - DateTime dateWithNoTz = DateTime.Parse ("2008-04-10T13:30:00.000", null, System.Globalization.DateTimeStyles.RoundtripKind); - Assert.AreEqual ("2008-04-10T13:30:00.0000000", api.ParameterToString (dateWithNoTz)); - } - - // The test below only passes when running at -04:00 timezone - [Ignore ()] - public void TestParameterToStringWithTimeZoneForDateTime () - { - ApiClient api = new ApiClient (); - // test datetime with a time zone - DateTimeOffset dateWithTz = DateTimeOffset.Parse("2008-04-10T13:30:00.0000000-04:00", null, System.Globalization.DateTimeStyles.RoundtripKind); - Assert.AreEqual("2008-04-10T13:30:00.0000000-04:00", api.ParameterToString(dateWithTz)); - } - - [Test ()] - public void TestParameterToStringForDateTimeWithUFormat () - { - // Setup the DateTimeFormat across all of the calls - Configuration.Default.DateTimeFormat = "u"; - ApiClient api = new ApiClient(); - - // test datetime - DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind); - Assert.AreEqual("2009-06-15 20:45:30Z", api.ParameterToString(dateUtc)); - } - - [Test ()] - public void TestParameterToStringForDateTimeWithCustomFormat () - { - // Setup the DateTimeFormat across all of the calls - Configuration.Default.DateTimeFormat = "dd/MM/yy HH:mm:ss"; - ApiClient api = new ApiClient(); - - // test datetime - DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind); - Assert.AreEqual("15/06/09 20:45:30", api.ParameterToString(dateUtc)); - } - - [Test ()] - public void TestSanitizeFilename () - { - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("sun.gif")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("../sun.gif")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("/var/tmp/sun.gif")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("./sun.gif")); - - Assert.AreEqual("sun", ApiClient.SanitizeFilename("sun")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("..\\sun.gif")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("\\var\\tmp\\sun.gif")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("c:\\var\\tmp\\sun.gif")); - Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename(".\\sun.gif")); - - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs deleted file mode 100644 index f2af87bb2426..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs +++ /dev/null @@ -1,171 +0,0 @@ -using NUnit.Framework; -using System; -using System.Collections.Generic; -using IO.Swagger.Client; -using IO.Swagger.Api; -using IO.Swagger.Model; - -namespace IO.Swagger.Test -{ - public class ConfigurationTests - { - public ConfigurationTests () - { - } - - [SetUp()] - public void BeforeEach() - { - var config = new GlobalConfiguration(); - Configuration.Default = config; - - // Reset to default, just in case - Configuration.Default.DateTimeFormat = "o"; - } - - [Test ()] - public void TestAuthentication () - { - Configuration c = new Configuration (); - c.Username = "test_username"; - c.Password = "test_password"; - - c.ApiKey ["api_key_identifier"] = "1233456778889900"; - c.ApiKeyPrefix ["api_key_identifier"] = "PREFIX"; - Assert.AreEqual (c.GetApiKeyWithPrefix("api_key_identifier"), "PREFIX 1233456778889900"); - - } - - [Test ()] - public void TestBasePath () - { - PetApi p = new PetApi ("http://new-basepath.com"); - Assert.AreEqual (p.Configuration.ApiClient.RestClient.BaseUrl, "http://new-basepath.com"); - // Given that PetApi is initailized with a base path, a new configuration (with a new ApiClient) - // is created by default - Assert.AreNotSame (p.Configuration, Configuration.Default); - } - - [Test ()] - public void TestDateTimeFormat_Default () - { - // Should default to the Round-trip Format Specifier - "o" - // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 - Assert.AreEqual("o", Configuration.Default.DateTimeFormat); - } - - [Test ()] - public void TestDateTimeFormat_UType() - { - Configuration.Default.DateTimeFormat = "u"; - - Assert.AreEqual("u", Configuration.Default.DateTimeFormat); - } - - [Test()] - public void TestDateTimeFormat_UType_NonGlobal() - { - Configuration configuration = new Configuration(); - configuration.DateTimeFormat = "u"; - - Assert.AreEqual("u", configuration.DateTimeFormat); - Assert.AreNotEqual("u", Configuration.Default.DateTimeFormat); - } - - [Test ()] - public void TestConstruction() - { - Configuration c = new Configuration { Username = "test username", Password = "test password" }; - Assert.AreEqual (c.Username, "test username"); - Assert.AreEqual (c.Password, "test password"); - - } - - [Test ()] - public void TestDefautlConfiguration () - { - PetApi p1 = new PetApi (); - PetApi p2 = new PetApi (); - Assert.AreSame (p1.Configuration, p2.Configuration); - // same as the default - Assert.AreSame (p1.Configuration, Configuration.Default); - - Configuration c = new Configuration (); - Assert.AreNotSame (c, p1.Configuration); - - PetApi p3 = new PetApi (c); - // same as c - Assert.AreSame (p3.Configuration, c); - // not same as default - Assert.AreNotSame (p3.Configuration, p1.Configuration); - - } - - [Test ()] - public void TestUsage () - { - // basic use case using default base URL - PetApi p1 = new PetApi (); - Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration"); - - // using a different base URL - PetApi p2 = new PetApi ("http://new-base-url.com/"); - Assert.AreEqual (p2.Configuration.ApiClient.RestClient.BaseUrl.ToString(), "http://new-base-url.com/"); - - // using a different configuration - Configuration c1 = new Configuration (); - PetApi p3 = new PetApi (c1); - Assert.AreSame (p3.Configuration, c1); - - // using a different base URL via a new Configuration - String newApiClientUrl = "http://new-api-client.com"; - Configuration c2 = new Configuration { BasePath = newApiClientUrl }; - PetApi p4 = new PetApi (c2); - Assert.AreEqual(p4.Configuration.ApiClient.RestClient.BaseUrl, new Uri(newApiClientUrl)); - } - - [Test ()] - public void TestTimeout () - { - Configuration c1 = new Configuration (); - Assert.AreEqual (100000, c1.Timeout); // default vaue - - c1.Timeout = 50000; - Assert.AreEqual (50000, c1.Timeout); - - Configuration c2 = new Configuration { Timeout = 20000 }; - Assert.AreEqual (20000, c2.Timeout); - } - - [Test()] - public void TestAddingInstanceHeadersDoesNotModifyGlobal() - { - // Arrange - Configuration.Default.DefaultHeader.Add("Content-Type", "application/json"); - Configuration.Default.ApiKey.Add("api_key_identifier", "1233456778889900"); - Configuration.Default.ApiKeyPrefix.Add("api_key_identifier", "PREFIX"); - - Configuration c = new Configuration( - Configuration.Default.DefaultHeader, - Configuration.Default.ApiKey, - Configuration.Default.ApiKeyPrefix - ); - - // sanity - CollectionAssert.AreEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader); - CollectionAssert.AreEquivalent(c.ApiKey, Configuration.Default.ApiKey); - CollectionAssert.AreEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix); - - // Act - Configuration.Default.DefaultHeader["Content-Type"] = "application/xml"; - Configuration.Default.ApiKey["api_key_identifier"] = "00000000000001234"; - Configuration.Default.ApiKeyPrefix["api_key_identifier"] = "MODIFIED"; - - // Assert - CollectionAssert.AreNotEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader); - CollectionAssert.AreNotEquivalent(c.ApiKey, Configuration.Default.ApiKey); - CollectionAssert.AreNotEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix); - } - } -} - 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 b09487f71b6f..b6968c359387 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 @@ -6,19 +6,6 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod 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. --> @@ -65,6 +52,12 @@ limitations under the License. ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll @@ -79,20 +72,18 @@ limitations under the License. - + - - {391DEE9D-C48B-4846-838D-E96F4BC01E1D} - IO.Swagger - - - - + + {321C8C3F-0156-40C1-AE42-D59761FB9B6C} + IO.Swagger + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs index b4680801e4cf..60b6cee9f538 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class AdditionalPropertiesClassTests { - private AdditionalPropertiesClass instance; + // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass + //private AdditionalPropertiesClass instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new AdditionalPropertiesClass(); + // TODO uncomment below to create an instance of AdditionalPropertiesClass + //instance = new AdditionalPropertiesClass(); } /// @@ -47,10 +61,28 @@ namespace IO.Swagger.Test [Test] public void AdditionalPropertiesClassInstanceTest() { - Assert.IsInstanceOfType(typeof(AdditionalPropertiesClass), instance, "instance is a AdditionalPropertiesClass"); + // TODO uncomment below to test "IsInstanceOfType" AdditionalPropertiesClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a AdditionalPropertiesClass"); } + /// + /// Test the property 'MapProperty' + /// + [Test] + public void MapPropertyTest() + { + // TODO unit test for the property 'MapProperty' + } + /// + /// Test the property 'MapOfMapProperty' + /// + [Test] + public void MapOfMapPropertyTest() + { + // TODO unit test for the property 'MapOfMapProperty' + } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs index 6e824fbfd842..6fa7b87485a7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class AnimalFarmTests { - private AnimalFarm instance; + // TODO uncomment below to declare an instance variable for AnimalFarm + //private AnimalFarm instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new AnimalFarm(); + // TODO uncomment below to create an instance of AnimalFarm + //instance = new AnimalFarm(); } /// @@ -47,10 +61,12 @@ namespace IO.Swagger.Test [Test] public void AnimalFarmInstanceTest() { - Assert.IsInstanceOfType(typeof(AnimalFarm), instance, "instance is a AnimalFarm"); + // TODO uncomment below to test "IsInstanceOfType" AnimalFarm + //Assert.IsInstanceOfType (instance, "variable 'instance' is a AnimalFarm"); } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs index 29c668f12ab9..ba3786457af8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -22,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class AnimalTests { - private Animal instance; + // TODO uncomment below to declare an instance variable for Animal + //private Animal instance; /// /// Setup before each test @@ -30,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Animal(ClassName: "csharp test"); + // TODO uncomment below to create an instance of Animal + //instance = new Animal(); } /// @@ -48,7 +61,8 @@ namespace IO.Swagger.Test [Test] public void AnimalInstanceTest() { - Assert.IsInstanceOfType(typeof(Animal), instance, "instance is a Animal"); + // TODO uncomment below to test "IsInstanceOfType" Animal + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Animal"); } /// @@ -76,7 +90,15 @@ namespace IO.Swagger.Test [Test] public void ClassNameTest() { - // TODO: unit test for the property 'ClassName' + // TODO unit test for the property 'ClassName' + } + /// + /// Test the property 'Color' + /// + [Test] + public void ColorTest() + { + // TODO unit test for the property 'Color' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs index 13d4310916b1..8a5649b4676b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class ApiResponseTests { - private ApiResponse instance; + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new ApiResponse(); + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void ApiResponseInstanceTest() { - Assert.IsInstanceOfType(typeof(ApiResponse), instance, "instance is a ApiResponse"); + // TODO uncomment below to test "IsInstanceOfType" ApiResponse + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ApiResponse"); } + /// /// Test the property 'Code' /// [Test] public void CodeTest() { - // TODO: unit test for the property 'Code' + // TODO unit test for the property 'Code' } /// /// Test the property 'Type' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void TypeTest() { - // TODO: unit test for the property 'Type' + // TODO unit test for the property 'Type' } /// /// Test the property 'Message' @@ -72,7 +88,7 @@ namespace IO.Swagger.Test [Test] public void MessageTest() { - // TODO: unit test for the property 'Message' + // TODO unit test for the property 'Message' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs index 048173f80ef7..3f8f100a7f58 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly"); } + /// /// Test the property 'ArrayArrayNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs index fafa4caf843b..28a540e676ba 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfNumberOnly"); } + /// /// Test the property 'ArrayNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs index c063340171fc..09864b81ac2a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class ArrayTestTests { - private ArrayTest instance; + // TODO uncomment below to declare an instance variable for ArrayTest + //private ArrayTest instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new ArrayTest(); + // TODO uncomment below to create an instance of ArrayTest + //instance = new ArrayTest(); } /// @@ -47,10 +61,36 @@ namespace IO.Swagger.Test [Test] public void ArrayTestInstanceTest() { - Assert.IsInstanceOfType(typeof(ArrayTest), instance, "instance is a ArrayTest"); + // TODO uncomment below to test "IsInstanceOfType" ArrayTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayTest"); } + /// + /// Test the property 'ArrayOfString' + /// + [Test] + public void ArrayOfStringTest() + { + // TODO unit test for the property 'ArrayOfString' + } + /// + /// Test the property 'ArrayArrayOfInteger' + /// + [Test] + public void ArrayArrayOfIntegerTest() + { + // TODO unit test for the property 'ArrayArrayOfInteger' + } + /// + /// Test the property 'ArrayArrayOfModel' + /// + [Test] + public void ArrayArrayOfModelTest() + { + // TODO unit test for the property 'ArrayArrayOfModel' + } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CapitalizationTests.cs index 30ed8700f748..fe7637ded78c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CapitalizationTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CapitalizationTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization"); } + /// /// Test the property 'SmallCamel' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs index 8a6abb12f622..d79719efdbc3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class CatTests { - private Cat instance; + // TODO uncomment below to declare an instance variable for Cat + //private Cat instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Cat(ClassName: "csharp test"); + // TODO uncomment below to create an instance of Cat + //instance = new Cat(); } /// @@ -47,24 +61,18 @@ namespace IO.Swagger.Test [Test] public void CatInstanceTest() { - Assert.IsInstanceOfType(typeof(Cat), instance, "instance is a Cat"); + // TODO uncomment below to test "IsInstanceOfType" Cat + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Cat"); } - /// - /// Test the property 'ClassName' - /// - [Test] - public void ClassNameTest() - { - // TODO: unit test for the property 'ClassName' - } + /// /// Test the property 'Declawed' /// [Test] public void DeclawedTest() { - // TODO: unit test for the property 'Declawed' + // TODO unit test for the property 'Declawed' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs index 3c7ba0499aac..13497ed1fd69 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class CategoryTests { - private Category instance; + // TODO uncomment below to declare an instance variable for Category + //private Category instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Category(); + // TODO uncomment below to create an instance of Category + //instance = new Category(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void CategoryInstanceTest() { - Assert.IsInstanceOfType(typeof(Category), instance, "instance is a Category"); + // TODO uncomment below to test "IsInstanceOfType" Category + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Category"); } + /// /// Test the property 'Id' /// [Test] public void IdTest() { - // TODO: unit test for the property 'Id' + // TODO unit test for the property 'Id' } /// /// Test the property 'Name' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void NameTest() { - // TODO: unit test for the property 'Name' + // TODO unit test for the property 'Name' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ClassModelTests.cs index 01b2c5b9c1b6..2589ea4ecea7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ClassModelTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ClassModelTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ClassModel"); } + /// /// Test the property '_Class' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs index 5d3b6fef1759..3f47e42e8c27 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class DogTests { - private Dog instance; + // TODO uncomment below to declare an instance variable for Dog + //private Dog instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Dog(ClassName: "csharp test"); + // TODO uncomment below to create an instance of Dog + //instance = new Dog(); } /// @@ -47,24 +61,18 @@ namespace IO.Swagger.Test [Test] public void DogInstanceTest() { - Assert.IsInstanceOfType(typeof(Dog), instance, "instance is a Dog"); + // TODO uncomment below to test "IsInstanceOfType" Dog + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Dog"); } - /// - /// Test the property 'ClassName' - /// - [Test] - public void ClassNameTest() - { - // TODO: unit test for the property 'ClassName' - } + /// /// Test the property 'Breed' /// [Test] public void BreedTest() { - // TODO: unit test for the property 'Breed' + // TODO unit test for the property 'Breed' } } 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 index eb76effacc73..f84821d33eb7 100644 --- 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 @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumArrays"); } + /// /// Test the property 'JustSymbol' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs index 154e3c7b57a4..b37648d2200a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class EnumClassTests { - private EnumClass instance; + // TODO uncomment below to declare an instance variable for EnumClass + //private EnumClass instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new EnumClass(); + // TODO uncomment below to create an instance of EnumClass + //instance = new EnumClass(); } /// @@ -47,25 +61,11 @@ namespace IO.Swagger.Test [Test] public void EnumClassInstanceTest() { - Assert.IsInstanceOfType(typeof(EnumClass), instance, "instance is a EnumClass"); + // TODO uncomment below to test "IsInstanceOfType" EnumClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumClass"); } - /// - /// Test EnumClass - /// - [Test] - public void EnumClassValueTest () - { - // test serialization for string - Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\""); - // test serialization for number - Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1), "\"-1\""); - - // test cast to int - Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS_1, -1); - - } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs index 9ea929a0cd6f..66664cbd9af1 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class EnumTestTests { - private EnumTest instance; + // TODO uncomment below to declare an instance variable for EnumTest + //private EnumTest instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new EnumTest(); + // TODO uncomment below to create an instance of EnumTest + //instance = new EnumTest(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void EnumTestInstanceTest() { - Assert.IsInstanceOfType(typeof(EnumTest), instance, "instance is a EnumTest"); + // TODO uncomment below to test "IsInstanceOfType" EnumTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumTest"); } + /// /// Test the property 'EnumString' /// [Test] public void EnumStringTest() { - // TODO: unit test for the property 'EnumString' + // TODO unit test for the property 'EnumString' } /// /// Test the property 'EnumInteger' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void EnumIntegerTest() { - // TODO: unit test for the property 'EnumInteger' + // TODO unit test for the property 'EnumInteger' } /// /// Test the property 'EnumNumber' @@ -72,7 +88,15 @@ namespace IO.Swagger.Test [Test] public void EnumNumberTest() { - // TODO: unit test for the property 'EnumNumber' + // TODO unit test for the property 'EnumNumber' + } + /// + /// Test the property 'OuterEnum' + /// + [Test] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs index a5698af8b8fb..3ae16b2fc6b8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -22,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class FormatTestTests { - private FormatTest instance; + // TODO uncomment below to declare an instance variable for FormatTest + //private FormatTest instance; /// /// Setup before each test @@ -30,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new FormatTest(Number: 123, _Byte: new byte[] { 0x20 }, Date: new DateTime(2015, 1, 18), Password: "xyz"); + // TODO uncomment below to create an instance of FormatTest + //instance = new FormatTest(); } /// @@ -48,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void FormatTestInstanceTest() { - Assert.IsInstanceOfType(typeof(FormatTest), instance, "instance is a FormatTest"); + // TODO uncomment below to test "IsInstanceOfType" FormatTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FormatTest"); } + /// /// Test the property 'Integer' /// [Test] public void IntegerTest() { - // TODO: unit test for the property 'Integer' + // TODO unit test for the property 'Integer' } /// /// Test the property 'Int32' @@ -65,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void Int32Test() { - // TODO: unit test for the property 'Int32' + // TODO unit test for the property 'Int32' } /// /// Test the property 'Int64' @@ -73,7 +88,7 @@ namespace IO.Swagger.Test [Test] public void Int64Test() { - // TODO: unit test for the property 'Int64' + // TODO unit test for the property 'Int64' } /// /// Test the property 'Number' @@ -81,7 +96,7 @@ namespace IO.Swagger.Test [Test] public void NumberTest() { - // TODO: unit test for the property 'Number' + // TODO unit test for the property 'Number' } /// /// Test the property '_Float' @@ -89,7 +104,7 @@ namespace IO.Swagger.Test [Test] public void _FloatTest() { - // TODO: unit test for the property '_Float' + // TODO unit test for the property '_Float' } /// /// Test the property '_Double' @@ -97,7 +112,7 @@ namespace IO.Swagger.Test [Test] public void _DoubleTest() { - // TODO: unit test for the property '_Double' + // TODO unit test for the property '_Double' } /// /// Test the property '_String' @@ -105,7 +120,7 @@ namespace IO.Swagger.Test [Test] public void _StringTest() { - // TODO: unit test for the property '_String' + // TODO unit test for the property '_String' } /// /// Test the property '_Byte' @@ -113,7 +128,7 @@ namespace IO.Swagger.Test [Test] public void _ByteTest() { - // TODO: unit test for the property '_Byte' + // TODO unit test for the property '_Byte' } /// /// Test the property 'Binary' @@ -121,7 +136,7 @@ namespace IO.Swagger.Test [Test] public void BinaryTest() { - // TODO: unit test for the property 'Binary' + // TODO unit test for the property 'Binary' } /// /// Test the property 'Date' @@ -129,23 +144,7 @@ namespace IO.Swagger.Test [Test] public void DateTest() { - var item = new FormatTest(Integer: 1, - Int32: 1, - Int64: 1, - Number: 1, - _Float: 1.0f, - _Double: 1.0d, - _String: "", - _Byte: new byte[0], - Binary: null, - Date: new DateTime(year: 2000, month: 5, day: 13), - DateTime: null, - Uuid: null, - Password: ""); - - var serialized = JsonConvert.SerializeObject(item); - Console.WriteLine(serialized); - Assert.Greater(serialized.IndexOf("\"2000-05-13\""), 0); + // TODO unit test for the property 'Date' } /// /// Test the property 'DateTime' @@ -153,7 +152,7 @@ namespace IO.Swagger.Test [Test] public void DateTimeTest() { - // TODO: unit test for the property 'DateTime' + // TODO unit test for the property 'DateTime' } /// /// Test the property 'Uuid' @@ -161,7 +160,7 @@ namespace IO.Swagger.Test [Test] public void UuidTest() { - // TODO: unit test for the property 'Uuid' + // TODO unit test for the property 'Uuid' } /// /// Test the property 'Password' @@ -169,7 +168,7 @@ namespace IO.Swagger.Test [Test] public void PasswordTest() { - // TODO: unit test for the property 'Password' + // TODO unit test for the property 'Password' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs index d2be5717c4e5..cafd23d90b21 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a HasOnlyReadOnly"); } + /// /// Test the property 'Bar' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ListTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ListTests.cs index 2d383b814b57..6ca026a83e0f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ListTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ListTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a List"); } + /// /// Test the property '_123List' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MapTestTests.cs index 9cebfe18b244..d61693c33228 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MapTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MapTestTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a MapTest"); } + /// /// Test the property 'MapMapOfString' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs index 2157758ec1f2..55302d27c407 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class MixedPropertiesAndAdditionalPropertiesClassTests { - private MixedPropertiesAndAdditionalPropertiesClass instance; + // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass + //private MixedPropertiesAndAdditionalPropertiesClass instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new MixedPropertiesAndAdditionalPropertiesClass(); + // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //instance = new MixedPropertiesAndAdditionalPropertiesClass(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() { - Assert.IsInstanceOfType(typeof(MixedPropertiesAndAdditionalPropertiesClass), instance, "instance is a MixedPropertiesAndAdditionalPropertiesClass"); + // TODO uncomment below to test "IsInstanceOfType" MixedPropertiesAndAdditionalPropertiesClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a MixedPropertiesAndAdditionalPropertiesClass"); } + /// /// Test the property 'Uuid' /// [Test] public void UuidTest() { - // TODO: unit test for the property 'Uuid' + // TODO unit test for the property 'Uuid' } /// /// Test the property 'DateTime' @@ -64,7 +80,15 @@ namespace IO.Swagger.Test [Test] public void DateTimeTest() { - // TODO: unit test for the property 'DateTime' + // TODO unit test for the property 'DateTime' + } + /// + /// Test the property 'Map' + /// + [Test] + public void MapTest() + { + // TODO unit test for the property 'Map' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs index 13bbc1b1c7df..cdb0c1960c28 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class Model200ResponseTests { - private Model200Response instance; + // TODO uncomment below to declare an instance variable for Model200Response + //private Model200Response instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Model200Response(); + // TODO uncomment below to create an instance of Model200Response + //instance = new Model200Response(); } /// @@ -47,16 +61,26 @@ namespace IO.Swagger.Test [Test] public void Model200ResponseInstanceTest() { - Assert.IsInstanceOfType(typeof(Model200Response), instance, "instance is a Model200Response"); + // TODO uncomment below to test "IsInstanceOfType" Model200Response + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Model200Response"); } + /// /// Test the property 'Name' /// [Test] public void NameTest() { - // TODO: unit test for the property 'Name' + // TODO unit test for the property 'Name' + } + /// + /// Test the property '_Class' + /// + [Test] + public void _ClassTest() + { + // TODO unit test for the property '_Class' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelClientTests.cs index f38a30509405..f552ab929590 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelClientTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelClientTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelClient"); } + /// /// Test the property '_Client' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs index 53e62fc51a33..7c9ca513a7db 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class ModelReturnTests { - private ModelReturn instance; + // TODO uncomment below to declare an instance variable for ModelReturn + //private ModelReturn instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new ModelReturn(); + // TODO uncomment below to create an instance of ModelReturn + //instance = new ModelReturn(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void ModelReturnInstanceTest() { - Assert.IsInstanceOfType(typeof(ModelReturn), instance, "instance is a ModelReturn"); + // TODO uncomment below to test "IsInstanceOfType" ModelReturn + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelReturn"); } + /// /// Test the property '_Return' /// [Test] public void _ReturnTest() { - // TODO: unit test for the property '_Return' + // TODO unit test for the property '_Return' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs index d1e0deec41f3..3802292269ac 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class NameTests { - private Name instance; + // TODO uncomment below to declare an instance variable for Name + //private Name instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Name(_Name: 1, Property: "csharp"); + // TODO uncomment below to create an instance of Name + //instance = new Name(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void NameInstanceTest() { - Assert.IsInstanceOfType(typeof(Name), instance, "instance is a Name"); + // TODO uncomment below to test "IsInstanceOfType" Name + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Name"); } + /// /// Test the property '_Name' /// [Test] public void _NameTest() { - // TODO: unit test for the property '_Name' + // TODO unit test for the property '_Name' } /// /// Test the property 'SnakeCase' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void SnakeCaseTest() { - // TODO: unit test for the property 'SnakeCase' + // TODO unit test for the property 'SnakeCase' } /// /// Test the property 'Property' @@ -72,7 +88,15 @@ namespace IO.Swagger.Test [Test] public void PropertyTest() { - // TODO: unit test for the property 'Property' + // TODO unit test for the property 'Property' + } + /// + /// Test the property '_123Number' + /// + [Test] + public void _123NumberTest() + { + // TODO unit test for the property '_123Number' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NumberOnlyTests.cs index aecbedb83d3d..afa72bf45e41 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NumberOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NumberOnlyTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a NumberOnly"); } + /// /// Test the property 'JustNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs index 799b6ef43f8a..40757e5c01ca 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class OrderTests { - private Order instance; + // TODO uncomment below to declare an instance variable for Order + //private Order instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Order(); + // TODO uncomment below to create an instance of Order + //instance = new Order(); } /// @@ -41,32 +55,24 @@ namespace IO.Swagger.Test } - /// - /// Test creating a new instance of Order - /// - [Test ()] - public void TestNewOrder() - { - Order o = new Order (); - Assert.IsNull (o.Id); - } - /// /// Test an instance of Order /// [Test] public void OrderInstanceTest() { - Assert.IsInstanceOfType(typeof(Order), instance, "instance is a Order"); + // TODO uncomment below to test "IsInstanceOfType" Order + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Order"); } + /// /// Test the property 'Id' /// [Test] public void IdTest() { - // TODO: unit test for the property 'Id' + // TODO unit test for the property 'Id' } /// /// Test the property 'PetId' @@ -74,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void PetIdTest() { - // TODO: unit test for the property 'PetId' + // TODO unit test for the property 'PetId' } /// /// Test the property 'Quantity' @@ -82,7 +88,7 @@ namespace IO.Swagger.Test [Test] public void QuantityTest() { - // TODO: unit test for the property 'Quantity' + // TODO unit test for the property 'Quantity' } /// /// Test the property 'ShipDate' @@ -90,7 +96,7 @@ namespace IO.Swagger.Test [Test] public void ShipDateTest() { - // TODO: unit test for the property 'ShipDate' + // TODO unit test for the property 'ShipDate' } /// /// Test the property 'Status' @@ -98,7 +104,7 @@ namespace IO.Swagger.Test [Test] public void StatusTest() { - // TODO: unit test for the property 'Status' + // TODO unit test for the property 'Status' } /// /// Test the property 'Complete' @@ -106,7 +112,7 @@ namespace IO.Swagger.Test [Test] public void CompleteTest() { - // TODO: unit test for the property 'Complete' + // TODO unit test for the property 'Complete' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs index a24e20009cce..81a6cdf53235 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs index 3d2ab500d1a3..8cae88a554ad 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterComposite"); } + /// /// Test the property 'MyNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterEnumTests.cs index e6bd10d185f9..b65bc240b0d3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterEnumTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterEnumTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs index 66a97a03e7ba..55ebb7da9fda 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs index f6397957ece3..76a2c2253dc7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs index 7029264ee06e..89b221bde942 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,9 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class PetTests { - private Pet instance; - - private long petId = 11088; + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; /// /// Setup before each test @@ -31,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Pet(Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); } /// @@ -49,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void PetInstanceTest() { - Assert.IsInstanceOfType(typeof(Pet), instance, "instance is a Pet"); + // TODO uncomment below to test "IsInstanceOfType" Pet + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Pet"); } + /// /// Test the property 'Id' /// [Test] public void IdTest() { - // TODO: unit test for the property 'Id' + // TODO unit test for the property 'Id' } /// /// Test the property 'Category' @@ -66,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void CategoryTest() { - // TODO: unit test for the property 'Category' + // TODO unit test for the property 'Category' } /// /// Test the property 'Name' @@ -74,7 +88,7 @@ namespace IO.Swagger.Test [Test] public void NameTest() { - // TODO: unit test for the property 'Name' + // TODO unit test for the property 'Name' } /// /// Test the property 'PhotoUrls' @@ -82,7 +96,7 @@ namespace IO.Swagger.Test [Test] public void PhotoUrlsTest() { - // TODO: unit test for the property 'PhotoUrls' + // TODO unit test for the property 'PhotoUrls' } /// /// Test the property 'Tags' @@ -90,7 +104,7 @@ namespace IO.Swagger.Test [Test] public void TagsTest() { - // TODO: unit test for the property 'Tags' + // TODO unit test for the property 'Tags' } /// /// Test the property 'Status' @@ -98,72 +112,9 @@ namespace IO.Swagger.Test [Test] public void StatusTest() { - // TODO: unit test for the property 'Status' + // TODO unit test for the property 'Status' } - /// - /// Test Equal - /// - [Test ()] - public void TestEqual() - { - // create pet - Pet p1 = new Pet (Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); - p1.Id = petId; - //p1.Name = "Csharp test"; - p1.Status = Pet.StatusEnum.Available; - // create Category object - Category category1 = new Category (); - category1.Id = 56; - category1.Name = "sample category name2"; - List photoUrls1 = new List (new String[] { "sample photoUrls" }); - // create Tag object - Tag tag1 = new Tag (); - tag1.Id = petId; - tag1.Name = "csharp sample tag name1"; - List tags1 = new List (new Tag[] { tag1 }); - p1.Tags = tags1; - p1.Category = category1; - p1.PhotoUrls = photoUrls1; - - // create pet 2 - Pet p2 = new Pet (Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); - p2.Id = petId; - p2.Name = "Csharp test"; - p2.Status = Pet.StatusEnum.Available; - // create Category object - Category category2 = new Category (); - category2.Id = 56; - category2.Name = "sample category name2"; - List photoUrls2 = new List (new String[] { "sample photoUrls" }); - // create Tag object - Tag tag2 = new Tag (); - tag2.Id = petId; - tag2.Name = "csharp sample tag name1"; - List tags2 = new List (new Tag[] { tag2 }); - p2.Tags = tags2; - p2.Category = category2; - p2.PhotoUrls = photoUrls2; - - // p1 and p2 should be equal (both object and attribute level) - Assert.IsTrue (category1.Equals (category2)); - Assert.IsTrue (tags1.SequenceEqual (tags2)); - Assert.IsTrue (p1.PhotoUrls.SequenceEqual (p2.PhotoUrls)); - - Assert.IsTrue (p1.Equals (p2)); - - // update attribute to that p1 and p2 are not equal - category2.Name = "new category name"; - Assert.IsFalse (category1.Equals (category2)); - - tags2 = new List (); - Assert.IsFalse (tags1.SequenceEqual (tags2)); - - // photoUrls has not changed so it should be equal - Assert.IsTrue (p1.PhotoUrls.SequenceEqual (p2.PhotoUrls)); - - Assert.IsFalse (p1.Equals (p2)); - } } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs index e0c4029546b0..f3836f4cabda 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class ReadOnlyFirstTests { - private ReadOnlyFirst instance; + // TODO uncomment below to declare an instance variable for ReadOnlyFirst + //private ReadOnlyFirst instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new ReadOnlyFirst(); + // TODO uncomment below to create an instance of ReadOnlyFirst + //instance = new ReadOnlyFirst(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void ReadOnlyFirstInstanceTest() { - Assert.IsInstanceOfType(typeof(ReadOnlyFirst), instance, "instance is a ReadOnlyFirst"); + // TODO uncomment below to test "IsInstanceOfType" ReadOnlyFirst + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ReadOnlyFirst"); } + /// /// Test the property 'Bar' /// [Test] public void BarTest() { - // TODO: unit test for the property 'Bar' + // TODO unit test for the property 'Bar' } /// /// Test the property 'Baz' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void BazTest() { - // TODO: unit test for the property 'Baz' + // TODO unit test for the property 'Baz' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs index eec6e837449e..547c62fd4820 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class SpecialModelNameTests { - private SpecialModelName instance; + // TODO uncomment below to declare an instance variable for SpecialModelName + //private SpecialModelName instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new SpecialModelName(); + // TODO uncomment below to create an instance of SpecialModelName + //instance = new SpecialModelName(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void SpecialModelNameInstanceTest() { - Assert.IsInstanceOfType(typeof(SpecialModelName), instance, "instance is a SpecialModelName"); + // TODO uncomment below to test "IsInstanceOfType" SpecialModelName + //Assert.IsInstanceOfType (instance, "variable 'instance' is a SpecialModelName"); } + /// /// Test the property 'SpecialPropertyName' /// [Test] public void SpecialPropertyNameTest() { - // TODO: unit test for the property 'SpecialPropertyName' + // TODO unit test for the property 'SpecialPropertyName' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs index 2b78594eb6f4..adb4bf7c8be0 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class TagTests { - private Tag instance; + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Tag(); + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void TagInstanceTest() { - Assert.IsInstanceOfType(typeof(Tag), instance, "instance is a Tag"); + // TODO uncomment below to test "IsInstanceOfType" Tag + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Tag"); } + /// /// Test the property 'Id' /// [Test] public void IdTest() { - // TODO: unit test for the property 'Id' + // TODO unit test for the property 'Id' } /// /// Test the property 'Name' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void NameTest() { - // TODO: unit test for the property 'Name' + // TODO unit test for the property 'Name' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs index 59451079ebff..1f64a7aa433a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs @@ -1,3 +1,14 @@ +/* + * 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 + */ + + using NUnit.Framework; using System; @@ -8,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -21,7 +33,8 @@ namespace IO.Swagger.Test [TestFixture] public class UserTests { - private User instance; + // TODO uncomment below to declare an instance variable for User + //private User instance; /// /// Setup before each test @@ -29,7 +42,8 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new User(); + // TODO uncomment below to create an instance of User + //instance = new User(); } /// @@ -47,16 +61,18 @@ namespace IO.Swagger.Test [Test] public void UserInstanceTest() { - Assert.IsInstanceOfType(typeof(User), instance, "instance is a User"); + // TODO uncomment below to test "IsInstanceOfType" User + //Assert.IsInstanceOfType (instance, "variable 'instance' is a User"); } + /// /// Test the property 'Id' /// [Test] public void IdTest() { - // TODO: unit test for the property 'Id' + // TODO unit test for the property 'Id' } /// /// Test the property 'Username' @@ -64,7 +80,7 @@ namespace IO.Swagger.Test [Test] public void UsernameTest() { - // TODO: unit test for the property 'Username' + // TODO unit test for the property 'Username' } /// /// Test the property 'FirstName' @@ -72,7 +88,7 @@ namespace IO.Swagger.Test [Test] public void FirstNameTest() { - // TODO: unit test for the property 'FirstName' + // TODO unit test for the property 'FirstName' } /// /// Test the property 'LastName' @@ -80,7 +96,7 @@ namespace IO.Swagger.Test [Test] public void LastNameTest() { - // TODO: unit test for the property 'LastName' + // TODO unit test for the property 'LastName' } /// /// Test the property 'Email' @@ -88,7 +104,7 @@ namespace IO.Swagger.Test [Test] public void EmailTest() { - // TODO: unit test for the property 'Email' + // TODO unit test for the property 'Email' } /// /// Test the property 'Password' @@ -96,7 +112,7 @@ namespace IO.Swagger.Test [Test] public void PasswordTest() { - // TODO: unit test for the property 'Password' + // TODO unit test for the property 'Password' } /// /// Test the property 'Phone' @@ -104,7 +120,7 @@ namespace IO.Swagger.Test [Test] public void PhoneTest() { - // TODO: unit test for the property 'Phone' + // TODO unit test for the property 'Phone' } /// /// Test the property 'UserStatus' @@ -112,7 +128,7 @@ namespace IO.Swagger.Test [Test] public void UserStatusTest() { - // TODO: unit test for the property 'UserStatus' + // TODO unit test for the property 'UserStatus' } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config index 105b8298a455..a5a85c7294c6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config @@ -3,4 +3,5 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/swagger-logo.png b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/swagger-logo.png deleted file mode 100644 index 7671d64c7da5..000000000000 Binary files a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/swagger-logo.png and /dev/null differ diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs deleted file mode 100644 index d33366a6fc7f..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ /dev/null @@ -1,331 +0,0 @@ -/* - * 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 - */ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace IO.Swagger.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFake_classname_tags123Api : IApiAccessor - { - #region Synchronous Operations - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// ModelClient - ModelClient TestClassname (ModelClient body); - - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// ApiResponse of ModelClient - ApiResponse TestClassnameWithHttpInfo (ModelClient body); - #endregion Synchronous Operations - #region Asynchronous Operations - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// Task of ModelClient - System.Threading.Tasks.Task TestClassnameAsync (ModelClient body); - - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class Fake_classname_tags123Api : IFake_classname_tags123Api - { - private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public Fake_classname_tags123Api(String basePath) - { - this.Configuration = new Configuration { BasePath = basePath }; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public Fake_classname_tags123Api(Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Sets the base path of the API client. - /// - /// The base path - [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] - public void SetBasePath(String basePath) - { - // do nothing - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Configuration Configuration {get; set;} - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public IO.Swagger.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Gets the default header. - /// - /// Dictionary of HTTP header - [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public IDictionary DefaultHeader() - { - return new ReadOnlyDictionary(this.Configuration.DefaultHeader); - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] - public void AddDefaultHeader(string key, string value) - { - this.Configuration.AddDefaultHeader(key, value); - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// ModelClient - public ModelClient TestClassname (ModelClient body) - { - ApiResponse localVarResponse = TestClassnameWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); - - var localVarPath = "/fake_classname_test"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (api_key_query) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestClassname", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClassnameAsync (ModelClient body) - { - ApiResponse localVarResponse = await TestClassnameAsyncWithHttpInfo(body); - return localVarResponse.Data; - - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); - - var localVarPath = "/fake_classname_test"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (api_key_query) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestClassname", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/JsonSubTypes.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/JsonSubTypes.cs deleted file mode 100644 index 3a6da091b781..000000000000 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/JsonSubTypes.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer.GenericTypeArguments[0]; - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType.GetTypeInfo().GetCustomAttributes()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType.GetTypeInfo().Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(IReadOnlyDictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type.GetTypeInfo().GetCustomAttributes().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType.GetTypeInfo().IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} 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 4d675069f387..07a431e8c70e 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 @@ -53,6 +53,12 @@ Contact: apiteam@swagger.io ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\packages\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 index 64f705748f2f..7455c8c42490 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs @@ -41,16 +41,20 @@ namespace IO.Swagger.Model /// Enum GreaterThanOrEqualTo for ">=" /// [EnumMember(Value = ">=")] - GreaterThanOrEqualTo, + GreaterThanOrEqualTo = 1, /// /// Enum Dollar for "$" /// [EnumMember(Value = "$")] - Dollar + Dollar = 2 } - + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// @@ -62,20 +66,16 @@ namespace IO.Swagger.Model /// Enum Fish for "fish" /// [EnumMember(Value = "fish")] - Fish, + Fish = 1, /// /// Enum Crab for "crab" /// [EnumMember(Value = "crab")] - Crab + Crab = 2 } - /// - /// Gets or Sets JustSymbol - /// - [DataMember(Name="just_symbol", EmitDefaultValue=false)] - public JustSymbolEnum? JustSymbol { get; set; } + /// /// Gets or Sets ArrayEnum /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs index 77fc0a8e299d..dbbcb0ebc2f6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs @@ -35,19 +35,19 @@ namespace IO.Swagger.Model /// Enum Abc for "_abc" /// [EnumMember(Value = "_abc")] - Abc, + Abc = 1, /// /// Enum Efg for "-efg" /// [EnumMember(Value = "-efg")] - Efg, + Efg = 2, /// /// Enum Xyz for "(xyz)" /// [EnumMember(Value = "(xyz)")] - Xyz + Xyz = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs index ebcfe3b0e46d..5eafb2bf7e0e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs @@ -41,21 +41,26 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower, + Lower = 2, /// /// Enum Empty for "" /// [EnumMember(Value = "")] - Empty + Empty = 3 } + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } /// /// Gets or Sets EnumInteger /// @@ -76,6 +81,11 @@ namespace IO.Swagger.Model NUMBER_MINUS_1 = -1 } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// @@ -87,38 +97,33 @@ namespace IO.Swagger.Model /// Enum NUMBER_1_DOT_1 for 1.1 /// [EnumMember(Value = "1.1")] - NUMBER_1_DOT_1, + NUMBER_1_DOT_1 = 1, /// /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 /// [EnumMember(Value = "-1.2")] - NUMBER_MINUS_1_DOT_2 + NUMBER_MINUS_1_DOT_2 = 2 } - /// - /// Gets or Sets EnumString - /// - [DataMember(Name="enum_string", EmitDefaultValue=false)] - public EnumStringEnum? EnumString { get; set; } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// [DataMember(Name="enum_number", EmitDefaultValue=false)] public EnumNumberEnum? EnumNumber { get; set; } /// + /// Gets or Sets OuterEnum + /// + [DataMember(Name="outerEnum", EmitDefaultValue=false)] + public OuterEnum? OuterEnum { get; set; } + /// /// Initializes a new instance of the class. /// /// EnumString. /// EnumInteger. /// EnumNumber. /// OuterEnum. - public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum OuterEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum? OuterEnum = default(OuterEnum?)) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -129,11 +134,6 @@ namespace IO.Swagger.Model - /// - /// Gets or Sets OuterEnum - /// - [DataMember(Name="outerEnum", EmitDefaultValue=false)] - public OuterEnum OuterEnum { get; set; } /// /// Returns the string presentation of the object diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs index d5fe36c4151c..4e6f88050cda 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs @@ -30,7 +30,6 @@ namespace IO.Swagger.Model [DataContract] public partial class MapTest : IEquatable, IValidatableObject { - /// /// Gets or Sets Inner /// @@ -42,15 +41,16 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower + Lower = 2 } + /// /// Gets or Sets MapOfEnumString /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs index e92a21c36c2e..994205ce1c11 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs @@ -42,19 +42,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterEnum.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterEnum.cs index 16135a6a0523..08b0e74ef099 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterEnum.cs @@ -35,19 +35,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs index fa39a5da19cf..2efeda676a5a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs @@ -42,19 +42,19 @@ namespace IO.Swagger.Model /// Enum Available for "available" /// [EnumMember(Value = "available")] - Available, + Available = 1, /// /// Enum Pending for "pending" /// [EnumMember(Value = "pending")] - Pending, + Pending = 2, /// /// Enum Sold for "sold" /// [EnumMember(Value = "sold")] - Sold + Sold = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config index 351ef133ee8c..76a7cbd76d71 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config @@ -2,4 +2,5 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClientNet40/docs/EnumTest.md index a4371a966956..5b38bb5b3a58 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/docs/EnumTest.md +++ b/samples/client/petstore/csharp/SwaggerClientNet40/docs/EnumTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **EnumString** | **string** | | [optional] **EnumInteger** | **int?** | | [optional] **EnumNumber** | **double?** | | [optional] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**OuterEnum** | **OuterEnum** | | [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/SwaggerClientNet40/git_push.sh b/samples/client/petstore/csharp/SwaggerClientNet40/git_push.sh index 792320114fbe..160f6f213999 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClientNet40/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 0bc4aee06e09..df92a9f7fd28 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -52,6 +52,12 @@ Contact: apiteam@swagger.io ..\..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/packages.config b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/packages.config index c01db0f14de4..1a903ca10f22 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/packages.config +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger.Test/packages.config @@ -3,4 +3,5 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Client/JsonSubTypes.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Client/JsonSubTypes.cs deleted file mode 100644 index 0dd09a25da20..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Client/JsonSubTypes.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType.IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer.GetGenericArguments().FirstOrDefault(); - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType.GetCustomAttributes(false).OfType()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType.Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(IDictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type.GetCustomAttributes(false).OfType().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType.IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/IO.Swagger.csproj index 626d37afe39b..684150cb2b6b 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/IO.Swagger.csproj @@ -53,6 +53,12 @@ Contact: apiteam@swagger.io ..\..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net40\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumArrays.cs index 64f705748f2f..7455c8c42490 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumArrays.cs @@ -41,16 +41,20 @@ namespace IO.Swagger.Model /// Enum GreaterThanOrEqualTo for ">=" /// [EnumMember(Value = ">=")] - GreaterThanOrEqualTo, + GreaterThanOrEqualTo = 1, /// /// Enum Dollar for "$" /// [EnumMember(Value = "$")] - Dollar + Dollar = 2 } - + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// @@ -62,20 +66,16 @@ namespace IO.Swagger.Model /// Enum Fish for "fish" /// [EnumMember(Value = "fish")] - Fish, + Fish = 1, /// /// Enum Crab for "crab" /// [EnumMember(Value = "crab")] - Crab + Crab = 2 } - /// - /// Gets or Sets JustSymbol - /// - [DataMember(Name="just_symbol", EmitDefaultValue=false)] - public JustSymbolEnum? JustSymbol { get; set; } + /// /// Gets or Sets ArrayEnum /// diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumClass.cs index 77fc0a8e299d..dbbcb0ebc2f6 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumClass.cs @@ -35,19 +35,19 @@ namespace IO.Swagger.Model /// Enum Abc for "_abc" /// [EnumMember(Value = "_abc")] - Abc, + Abc = 1, /// /// Enum Efg for "-efg" /// [EnumMember(Value = "-efg")] - Efg, + Efg = 2, /// /// Enum Xyz for "(xyz)" /// [EnumMember(Value = "(xyz)")] - Xyz + Xyz = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumTest.cs index ebcfe3b0e46d..5eafb2bf7e0e 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/EnumTest.cs @@ -41,21 +41,26 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower, + Lower = 2, /// /// Enum Empty for "" /// [EnumMember(Value = "")] - Empty + Empty = 3 } + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } /// /// Gets or Sets EnumInteger /// @@ -76,6 +81,11 @@ namespace IO.Swagger.Model NUMBER_MINUS_1 = -1 } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// @@ -87,38 +97,33 @@ namespace IO.Swagger.Model /// Enum NUMBER_1_DOT_1 for 1.1 /// [EnumMember(Value = "1.1")] - NUMBER_1_DOT_1, + NUMBER_1_DOT_1 = 1, /// /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 /// [EnumMember(Value = "-1.2")] - NUMBER_MINUS_1_DOT_2 + NUMBER_MINUS_1_DOT_2 = 2 } - /// - /// Gets or Sets EnumString - /// - [DataMember(Name="enum_string", EmitDefaultValue=false)] - public EnumStringEnum? EnumString { get; set; } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// [DataMember(Name="enum_number", EmitDefaultValue=false)] public EnumNumberEnum? EnumNumber { get; set; } /// + /// Gets or Sets OuterEnum + /// + [DataMember(Name="outerEnum", EmitDefaultValue=false)] + public OuterEnum? OuterEnum { get; set; } + /// /// Initializes a new instance of the class. /// /// EnumString. /// EnumInteger. /// EnumNumber. /// OuterEnum. - public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum OuterEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum? OuterEnum = default(OuterEnum?)) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -129,11 +134,6 @@ namespace IO.Swagger.Model - /// - /// Gets or Sets OuterEnum - /// - [DataMember(Name="outerEnum", EmitDefaultValue=false)] - public OuterEnum OuterEnum { get; set; } /// /// Returns the string presentation of the object diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/MapTest.cs index d5fe36c4151c..4e6f88050cda 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/MapTest.cs @@ -30,7 +30,6 @@ namespace IO.Swagger.Model [DataContract] public partial class MapTest : IEquatable, IValidatableObject { - /// /// Gets or Sets Inner /// @@ -42,15 +41,16 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower + Lower = 2 } + /// /// Gets or Sets MapOfEnumString /// diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Order.cs index e92a21c36c2e..994205ce1c11 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Order.cs @@ -42,19 +42,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/OuterEnum.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/OuterEnum.cs index 16135a6a0523..08b0e74ef099 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/OuterEnum.cs @@ -35,19 +35,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Pet.cs index fa39a5da19cf..2efeda676a5a 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/Model/Pet.cs @@ -42,19 +42,19 @@ namespace IO.Swagger.Model /// Enum Available for "available" /// [EnumMember(Value = "available")] - Available, + Available = 1, /// /// Enum Pending for "pending" /// [EnumMember(Value = "pending")] - Pending, + Pending = 2, /// /// Enum Sold for "sold" /// [EnumMember(Value = "sold")] - Sold + Sold = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/packages.config b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/packages.config index 3783fcf1985e..d66e5fa323ea 100644 --- a/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/packages.config +++ b/samples/client/petstore/csharp/SwaggerClientNet40/src/IO.Swagger/packages.config @@ -2,4 +2,5 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.gitignore b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.gitignore index d3f4f7b6f551..17302c93bf09 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.gitignore +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.gitignore @@ -6,6 +6,7 @@ *.suo *.user *.sln.docstates +./nuget # Build results diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md index 669dc91ea83d..0e226b9c0e63 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md @@ -19,7 +19,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c ## Dependencies - FubarCoder.RestSharp.Portable.Core >=4.0.7 - FubarCoder.RestSharp.Portable.HttpClient >=4.0.7 -- Newtonsoft.Json >=9.0.1 +- Newtonsoft.Json >=10.0.3 ## Installation @@ -48,17 +48,18 @@ namespace Example public void main() { - var apiInstance = new FakeApi(); - var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) + var apiInstance = new AnotherFakeApi(); + var body = new ModelClient(); // ModelClient | client model try { - OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); + // To test special tags + ModelClient result = apiInstance.TestSpecialTags(body); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); } } @@ -73,6 +74,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -80,7 +82,9 @@ Class | Method | HTTP request | Description *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *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 @@ -154,6 +158,13 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + ### http_basic_test diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/AnotherFakeApi.md similarity index 64% rename from samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/AnotherFakeApi.md index 9db41af1c5d5..89bc406754a8 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/AnotherFakeApi.md @@ -1,17 +1,19 @@ -# IO.Swagger.Api.Fake_classname_tags123Api +# IO.Swagger.Api.AnotherFakeApi All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestClassname**](Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestClassname** -> ModelClient TestClassname (ModelClient body) + +# **TestSpecialTags** +> ModelClient TestSpecialTags (ModelClient body) -To test class name in snake case +To test special tags + +To test special tags ### Example ```csharp @@ -23,22 +25,22 @@ using IO.Swagger.Model; namespace Example { - public class TestClassnameExample + public class TestSpecialTagsExample { public void main() { - var apiInstance = new Fake_classname_tags123Api(); + var apiInstance = new AnotherFakeApi(); var body = new ModelClient(); // ModelClient | client model try { - // To test class name in snake case - ModelClient result = apiInstance.TestClassname(body); + // To test special tags + ModelClient result = apiInstance.TestSpecialTags(body); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling Fake_classname_tags123Api.TestClassname: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/EnumTest.md index a4371a966956..5b38bb5b3a58 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/EnumTest.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/EnumTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **EnumString** | **string** | | [optional] **EnumInteger** | **int?** | | [optional] **EnumNumber** | **double?** | | [optional] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**OuterEnum** | **OuterEnum** | | [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/SwaggerClientNetCoreProject/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md index 3afd0a685ba0..bfc6bc813243 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md @@ -11,6 +11,8 @@ Method | HTTP request | Description [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[**TestInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data @@ -341,10 +343,10 @@ namespace Example Configuration.Default.Password = "YOUR_PASSWORD"; var apiInstance = new FakeApi(); - var number = 3.4; // decimal? | None + var number = 8.14; // decimal? | None var _double = 1.2; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None - var _byte = _byte_example; // byte[] | None + var _byte = B; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) @@ -478,3 +480,121 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestInlineAdditionalProperties** +> void TestInlineAdditionalProperties (Object param) + +test inline additionalProperties + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestInlineAdditionalPropertiesExample + { + public void main() + { + var apiInstance = new FakeApi(); + var param = ; // Object | request body + + try + { + // test inline additionalProperties + apiInstance.TestInlineAdditionalProperties(param); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **Object**| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **TestJsonFormData** +> void TestJsonFormData (string param, string param2) + +test json serialization of form data + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestJsonFormDataExample + { + public void main() + { + var apiInstance = new FakeApi(); + var param = param_example; // string | field1 + var param2 = param2_example; // string | field2 + + try + { + // test json serialization of form data + apiInstance.TestJsonFormData(param, param2); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **string**| field1 | + **param2** | **string**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeClassnameTags123Api.md similarity index 83% rename from samples/client/petstore/csharp/SwaggerClient/docs/Fake_classname_tags123Api.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeClassnameTags123Api.md index d79ca65f1f94..5f1d0ca776b4 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeClassnameTags123Api.md @@ -1,10 +1,10 @@ -# IO.Swagger.Api.Fake_classname_tags123Api +# IO.Swagger.Api.FakeClassnameTags123Api All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestClassname**](Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[**TestClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case @@ -32,7 +32,7 @@ namespace Example // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); - var apiInstance = new Fake_classname_tags123Api(); + var apiInstance = new FakeClassnameTags123Api(); var body = new ModelClient(); // ModelClient | client model try @@ -43,7 +43,7 @@ namespace Example } catch (Exception e) { - Debug.Print("Exception when calling Fake_classname_tags123Api.TestClassname: " + e.Message ); + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md index 148d49b8b88c..8654c43e51a2 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md @@ -20,8 +20,6 @@ Method | HTTP request | Description Add a new pet to the store - - ### Example ```csharp using System; @@ -83,8 +81,6 @@ void (empty response body) Deletes a pet - - ### Example ```csharp using System; @@ -293,9 +289,9 @@ namespace Example public void main() { // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + // Configuration.Default.AddApiKeyPrefix("api_key", "Bearer"); var apiInstance = new PetApi(); var petId = 789; // long? | ID of pet to return @@ -342,8 +338,6 @@ Name | Type | Description | Notes Update an existing pet - - ### Example ```csharp using System; @@ -405,8 +399,6 @@ void (empty response body) Updates a pet in the store with form data - - ### Example ```csharp using System; @@ -472,8 +464,6 @@ void (empty response body) uploads an image - - ### Example ```csharp using System; diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md index 1509a03158fa..28e3fe590676 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md @@ -93,9 +93,9 @@ namespace Example public void main() { // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + // Configuration.Default.AddApiKeyPrefix("api_key", "Bearer"); var apiInstance = new StoreApi(); @@ -199,8 +199,6 @@ No authorization required Place an order for a pet - - ### Example ```csharp using System; diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md index 0ddde3f669c8..fd9bfb0e9732 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md @@ -80,8 +80,6 @@ No authorization required Creates list of users with given input array - - ### Example ```csharp using System; @@ -140,8 +138,6 @@ No authorization required Creates list of users with given input array - - ### Example ```csharp using System; @@ -260,8 +256,6 @@ No authorization required Get user by user name - - ### Example ```csharp using System; @@ -321,8 +315,6 @@ No authorization required Logs user into the system - - ### Example ```csharp using System; @@ -384,8 +376,6 @@ No authorization required Logs out current logged in user session - - ### Example ```csharp using System; diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/git_push.sh b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/git_push.sh index 792320114fbe..160f6f213999 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/AnotherFakeApi.cs similarity index 85% rename from samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/Fake_classname_tags123Api.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/AnotherFakeApi.cs index 8c9f9c83fe1c..fd7f39a2fdd6 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/AnotherFakeApi.cs @@ -21,68 +21,68 @@ namespace IO.Swagger.Api /// /// Represents a collection of functions to interact with the API endpoints /// - public interface IFake_classname_tags123Api : IApiAccessor + public interface IAnotherFakeApi : IApiAccessor { #region Synchronous Operations /// - /// To test class name in snake case + /// To test special tags /// /// - /// + /// To test special tags /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestClassname (ModelClient body); + ModelClient TestSpecialTags (ModelClient body); /// - /// To test class name in snake case + /// To test special tags /// /// - /// + /// To test special tags /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestClassnameWithHttpInfo (ModelClient body); + ApiResponse TestSpecialTagsWithHttpInfo (ModelClient body); #endregion Synchronous Operations #region Asynchronous Operations /// - /// To test class name in snake case + /// To test special tags /// /// - /// + /// To test special tags /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - System.Threading.Tasks.Task TestClassnameAsync (ModelClient body); + System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient body); /// - /// To test class name in snake case + /// To test special tags /// /// - /// + /// To test special tags /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body); + System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient body); #endregion Asynchronous Operations } /// /// Represents a collection of functions to interact with the API endpoints /// - public partial class Fake_classname_tags123Api : IFake_classname_tags123Api + public partial class AnotherFakeApi : IAnotherFakeApi { private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - public Fake_classname_tags123Api(String basePath) + public AnotherFakeApi(String basePath) { this.Configuration = new Configuration { BasePath = basePath }; @@ -90,12 +90,12 @@ namespace IO.Swagger.Api } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// using Configuration object /// /// An instance of Configuration /// - public Fake_classname_tags123Api(Configuration configuration = null) + public AnotherFakeApi(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration this.Configuration = Configuration.Default; @@ -169,30 +169,30 @@ namespace IO.Swagger.Api } /// - /// To test class name in snake case + /// To test special tags To test special tags /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestClassname (ModelClient body) + public ModelClient TestSpecialTags (ModelClient body) { - ApiResponse localVarResponse = TestClassnameWithHttpInfo(body); + ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(body); return localVarResponse.Data; } /// - /// To test class name in snake case + /// To test special tags To test special tags /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) + public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient body) { // verify the required parameter 'body' is set if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + throw new ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->TestSpecialTags"); - var localVarPath = "./fake_classname_test"; + var localVarPath = "./another-fake/dummy"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); @@ -233,7 +233,7 @@ namespace IO.Swagger.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestClassname", localVarResponse); + Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); if (exception != null) throw exception; } @@ -243,31 +243,31 @@ namespace IO.Swagger.Api } /// - /// To test class name in snake case + /// To test special tags To test special tags /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - public async System.Threading.Tasks.Task TestClassnameAsync (ModelClient body) + public async System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient body) { - ApiResponse localVarResponse = await TestClassnameAsyncWithHttpInfo(body); + ApiResponse localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(body); return localVarResponse.Data; } /// - /// To test class name in snake case + /// To test special tags To test special tags /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body) + public async System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient body) { // verify the required parameter 'body' is set if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + throw new ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->TestSpecialTags"); - var localVarPath = "./fake_classname_test"; + var localVarPath = "./another-fake/dummy"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); @@ -308,7 +308,7 @@ namespace IO.Swagger.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestClassname", localVarResponse); + Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs index 2a053d7821a0..994936fbf23a 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs @@ -211,6 +211,50 @@ namespace IO.Swagger.Api /// Query parameter enum test (double) (optional) /// ApiResponse of Object(void) ApiResponse TestEnumParametersWithHttpInfo (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null); + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// + void TestInlineAdditionalProperties (Object param); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + ApiResponse TestInlineAdditionalPropertiesWithHttpInfo (Object param); + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// + void TestJsonFormData (string param, string param2); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// ApiResponse of Object(void) + ApiResponse TestJsonFormDataWithHttpInfo (string param, string param2); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -400,6 +444,50 @@ namespace IO.Swagger.Api /// Query parameter enum test (double) (optional) /// Task of ApiResponse System.Threading.Tasks.Task> TestEnumParametersAsyncWithHttpInfo (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null); + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Task of void + System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Task of ApiResponse + System.Threading.Tasks.Task> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param); + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of void + System.Threading.Tasks.Task TestJsonFormDataAsync (string param, string param2); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of ApiResponse + System.Threading.Tasks.Task> TestJsonFormDataAsyncWithHttpInfo (string param, string param2); #endregion Asynchronous Operations } @@ -1309,7 +1397,6 @@ namespace IO.Swagger.Api localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password); } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, @@ -1620,5 +1707,293 @@ namespace IO.Swagger.Api null); } + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// + public void TestInlineAdditionalProperties (Object param) + { + TestInlineAdditionalPropertiesWithHttpInfo(param); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + public ApiResponse TestInlineAdditionalPropertiesWithHttpInfo (Object param) + { + // verify the required parameter 'param' is set + if (param == null) + throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties"); + + var localVarPath = "./fake/inline-additionalProperties"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (param != null && param.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter + } + else + { + localVarPostBody = param; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Task of void + public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param) + { + await TestInlineAdditionalPropertiesAsyncWithHttpInfo(param); + + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param) + { + // verify the required parameter 'param' is set + if (param == null) + throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties"); + + var localVarPath = "./fake/inline-additionalProperties"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (param != null && param.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter + } + else + { + localVarPostBody = param; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// + public void TestJsonFormData (string param, string param2) + { + TestJsonFormDataWithHttpInfo(param, param2); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// ApiResponse of Object(void) + public ApiResponse TestJsonFormDataWithHttpInfo (string param, string param2) + { + // verify the required parameter 'param' is set + if (param == null) + throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + // verify the required parameter 'param2' is set + if (param2 == null) + throw new ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + + var localVarPath = "./fake/jsonFormData"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (param != null) localVarFormParams.Add("param", Configuration.ApiClient.ParameterToString(param)); // form parameter + if (param2 != null) localVarFormParams.Add("param2", Configuration.ApiClient.ParameterToString(param2)); // form parameter + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestJsonFormData", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of void + public async System.Threading.Tasks.Task TestJsonFormDataAsync (string param, string param2) + { + await TestJsonFormDataAsyncWithHttpInfo(param, param2); + + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestJsonFormDataAsyncWithHttpInfo (string param, string param2) + { + // verify the required parameter 'param' is set + if (param == null) + throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + // verify the required parameter 'param2' is set + if (param2 == null) + throw new ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + + var localVarPath = "./fake/jsonFormData"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (param != null) localVarFormParams.Add("param", Configuration.ApiClient.ParameterToString(param)); // form parameter + if (param2 != null) localVarFormParams.Add("param2", Configuration.ApiClient.ParameterToString(param2)); // form parameter + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestJsonFormData", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeClassnameTags123Api.cs similarity index 95% rename from samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeClassnameTags123Api.cs index a62ce556d4b5..77fcdddb2f75 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeClassnameTags123Api.cs @@ -21,7 +21,7 @@ namespace IO.Swagger.Api /// /// Represents a collection of functions to interact with the API endpoints /// - public interface IFake_classname_tags123Api : IApiAccessor + public interface IFakeClassnameTags123Api : IApiAccessor { #region Synchronous Operations /// @@ -74,15 +74,15 @@ namespace IO.Swagger.Api /// /// Represents a collection of functions to interact with the API endpoints /// - public partial class Fake_classname_tags123Api : IFake_classname_tags123Api + public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api { private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - public Fake_classname_tags123Api(String basePath) + public FakeClassnameTags123Api(String basePath) { this.Configuration = new Configuration { BasePath = basePath }; @@ -90,12 +90,12 @@ namespace IO.Swagger.Api } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// using Configuration object /// /// An instance of Configuration /// - public Fake_classname_tags123Api(Configuration configuration = null) + public FakeClassnameTags123Api(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration this.Configuration = Configuration.Default; @@ -190,7 +190,7 @@ namespace IO.Swagger.Api { // verify the required parameter 'body' is set if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname"); var localVarPath = "./fake_classname_test"; var localVarPathParams = new Dictionary(); @@ -270,7 +270,7 @@ namespace IO.Swagger.Api { // verify the required parameter 'body' is set if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname"); var localVarPath = "./fake_classname_test"; var localVarPathParams = new Dictionary(); diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs index 0a95c0e99ba1..63c520824f95 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs @@ -1144,7 +1144,6 @@ namespace IO.Swagger.Api localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs index c48bee756327..d1abfb9a83b3 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs @@ -470,7 +470,6 @@ namespace IO.Swagger.Api localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs index 7ed77bfba21e..a6282e41d544 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs @@ -144,14 +144,7 @@ namespace IO.Swagger.Client if (postBody != null) // http body (model or byte[]) parameter { - if (postBody.GetType() == typeof(String)) - { - request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = "application/json" }); - } - else if (postBody.GetType() == typeof(byte[])) - { - request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType }); - } + request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType }); } return request; @@ -356,9 +349,25 @@ namespace IO.Swagger.Client } } + /// + ///Check if the given MIME is a JSON MIME. + ///JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public bool IsJsonMime(String mime) + { + var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json")); + } + /// /// Select the Content-Type header's value from the given content-type array: - /// if JSON exists in the given array, use it; + /// if JSON type exists in the given array, use it; /// otherwise use the first one defined in 'consumes' /// /// The Content-Type array to select from. @@ -366,11 +375,14 @@ namespace IO.Swagger.Client public String SelectHeaderContentType(String[] contentTypes) { if (contentTypes.Length == 0) - return null; - - if (contentTypes.Contains("application/json", StringComparer.OrdinalIgnoreCase)) return "application/json"; + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType.ToLower())) + return contentType; + } + return contentTypes[0]; // use the first content type specified in 'consumes' } @@ -404,31 +416,29 @@ namespace IO.Swagger.Client /// /// Dynamically cast the object into target type. - /// Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast /// - /// Object to be casted - /// Target type + /// Object to be casted + /// Target type /// Casted object - public static dynamic ConvertType(dynamic source, Type dest) + public static dynamic ConvertType(dynamic fromObject, Type toObject) { - return Convert.ChangeType(source, dest); + return Convert.ChangeType(fromObject, toObject); } /// /// Convert stream to byte array - /// Credit/Ref: http://stackoverflow.com/a/221941/677735 /// - /// Input stream to be converted + /// Input stream to be converted /// Byte array - public static byte[] ReadAsBytes(Stream input) + public static byte[] ReadAsBytes(Stream inputStream) { - byte[] buffer = new byte[16*1024]; + byte[] buf = new byte[16*1024]; using (MemoryStream ms = new MemoryStream()) { - int read; - while ((read = input.Read(buffer, 0, buffer.Length)) > 0) + int count; + while ((count = inputStream.Read(buf, 0, buf.Length)) > 0) { - ms.Write(buffer, 0, read); + ms.Write(buf, 0, count); } return ms.ToArray(); } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs index bfea3c89bbaf..8c3926fa453c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs @@ -267,11 +267,11 @@ namespace IO.Swagger.Client public virtual string Password { get; set; } /// - /// Gets or sets the access token for OAuth2 authentication. + /// Gets the API key with prefix. /// /// API key identifier (authentication scheme). /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) + public string GetApiKeyWithPrefix(string apiKeyIdentifier) { var apiKeyValue = ""; ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs index ed1b6eddeacf..32e87d6bd9a3 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs @@ -18,18 +18,77 @@ namespace IO.Swagger.Client /// public interface IReadableConfiguration { + /// + /// Gets the access token. + /// + /// Access token. string AccessToken { get; } + + /// + /// Gets the API key. + /// + /// API key. IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time foramt. string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. IDictionary DefaultHeader { get; } - string Password { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. int Timeout { get; } + + /// + /// Gets the user agent. + /// + /// User agent. string UserAgent { get; } + + /// + /// Gets the username. + /// + /// Username. string Username { get; } + /// + /// Gets the password. + /// + /// Password. + string Password { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. string GetApiKeyWithPrefix(string apiKeyIdentifier); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/JsonSubTypes.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/JsonSubTypes.cs deleted file mode 100644 index 3a6da091b781..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/JsonSubTypes.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer.GenericTypeArguments[0]; - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType.GetTypeInfo().GetCustomAttributes()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType.GetTypeInfo().Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(IReadOnlyDictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type.GetTypeInfo().GetCustomAttributes().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType.GetTypeInfo().IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/IO.Swagger.csproj index cdef810205d5..6126e3b29cd1 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/IO.Swagger.csproj @@ -20,7 +20,8 @@ - + + diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AdditionalPropertiesClass.cs index 59577230d541..879bb7fcede7 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AdditionalPropertiesClass.cs @@ -77,35 +77,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as AdditionalPropertiesClass); + return this.Equals(input as AdditionalPropertiesClass); } /// /// Returns true if AdditionalPropertiesClass instances are equal /// - /// Instance of AdditionalPropertiesClass to be compared + /// Instance of AdditionalPropertiesClass to be compared /// Boolean - public bool Equals(AdditionalPropertiesClass other) + public bool Equals(AdditionalPropertiesClass input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.MapProperty == other.MapProperty || + this.MapProperty == input.MapProperty || this.MapProperty != null && - this.MapProperty.SequenceEqual(other.MapProperty) + this.MapProperty.SequenceEqual(input.MapProperty) ) && ( - this.MapOfMapProperty == other.MapOfMapProperty || + this.MapOfMapProperty == input.MapOfMapProperty || this.MapOfMapProperty != null && - this.MapOfMapProperty.SequenceEqual(other.MapOfMapProperty) + this.MapOfMapProperty.SequenceEqual(input.MapOfMapProperty) ); } @@ -115,16 +113,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.MapProperty != null) - hash = hash * 59 + this.MapProperty.GetHashCode(); + hashCode = hashCode * 59 + this.MapProperty.GetHashCode(); if (this.MapOfMapProperty != null) - hash = hash * 59 + this.MapOfMapProperty.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.MapOfMapProperty.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Animal.cs index e122ef49f469..b0b642e09ff2 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Animal.cs @@ -102,35 +102,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Animal); + return this.Equals(input as Animal); } /// /// Returns true if Animal instances are equal /// - /// Instance of Animal to be compared + /// Instance of Animal to be compared /// Boolean - public bool Equals(Animal other) + public bool Equals(Animal input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.ClassName == other.ClassName || - this.ClassName != null && - this.ClassName.Equals(other.ClassName) + this.ClassName == input.ClassName || + (this.ClassName != null && + this.ClassName.Equals(input.ClassName)) ) && ( - this.Color == other.Color || - this.Color != null && - this.Color.Equals(other.Color) + this.Color == input.Color || + (this.Color != null && + this.Color.Equals(input.Color)) ); } @@ -140,16 +138,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.ClassName != null) - hash = hash * 59 + this.ClassName.GetHashCode(); + hashCode = hashCode * 59 + this.ClassName.GetHashCode(); if (this.Color != null) - hash = hash * 59 + this.Color.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Color.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AnimalFarm.cs index 786c6005a98d..29b66e92d258 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/AnimalFarm.cs @@ -61,26 +61,24 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as AnimalFarm); + return this.Equals(input as AnimalFarm); } /// /// Returns true if AnimalFarm instances are equal /// - /// Instance of AnimalFarm to be compared + /// Instance of AnimalFarm to be compared /// Boolean - public bool Equals(AnimalFarm other) + public bool Equals(AnimalFarm input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; - return base.Equals(other); + return base.Equals(input); } /// @@ -89,12 +87,10 @@ namespace IO.Swagger.Model /// Hash code public override int GetHashCode() { - // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { - int hash = base.GetHashCode(); - // Suitable nullity checks etc, of course :) - return hash; + int hashCode = base.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ApiResponse.cs index 68b19d436267..8782c39aee24 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ApiResponse.cs @@ -86,40 +86,38 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ApiResponse); + return this.Equals(input as ApiResponse); } /// /// Returns true if ApiResponse instances are equal /// - /// Instance of ApiResponse to be compared + /// Instance of ApiResponse to be compared /// Boolean - public bool Equals(ApiResponse other) + public bool Equals(ApiResponse input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Code == other.Code || - this.Code != null && - this.Code.Equals(other.Code) + this.Code == input.Code || + (this.Code != null && + this.Code.Equals(input.Code)) ) && ( - this.Type == other.Type || - this.Type != null && - this.Type.Equals(other.Type) + this.Type == input.Type || + (this.Type != null && + this.Type.Equals(input.Type)) ) && ( - this.Message == other.Message || - this.Message != null && - this.Message.Equals(other.Message) + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) ); } @@ -129,18 +127,16 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Code != null) - hash = hash * 59 + this.Code.GetHashCode(); + hashCode = hashCode * 59 + this.Code.GetHashCode(); if (this.Type != null) - hash = hash * 59 + this.Type.GetHashCode(); + hashCode = hashCode * 59 + this.Type.GetHashCode(); if (this.Message != null) - hash = hash * 59 + this.Message.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Message.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs index 630fcea77fdc..011c403f455d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ArrayOfArrayOfNumberOnly); + return this.Equals(input as ArrayOfArrayOfNumberOnly); } /// /// Returns true if ArrayOfArrayOfNumberOnly instances are equal /// - /// Instance of ArrayOfArrayOfNumberOnly to be compared + /// Instance of ArrayOfArrayOfNumberOnly to be compared /// Boolean - public bool Equals(ArrayOfArrayOfNumberOnly other) + public bool Equals(ArrayOfArrayOfNumberOnly input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.ArrayArrayNumber == other.ArrayArrayNumber || + this.ArrayArrayNumber == input.ArrayArrayNumber || this.ArrayArrayNumber != null && - this.ArrayArrayNumber.SequenceEqual(other.ArrayArrayNumber) + this.ArrayArrayNumber.SequenceEqual(input.ArrayArrayNumber) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.ArrayArrayNumber != null) - hash = hash * 59 + this.ArrayArrayNumber.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.ArrayArrayNumber.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfNumberOnly.cs index c2a07e17a2bc..fe3f3f2fa861 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayOfNumberOnly.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ArrayOfNumberOnly); + return this.Equals(input as ArrayOfNumberOnly); } /// /// Returns true if ArrayOfNumberOnly instances are equal /// - /// Instance of ArrayOfNumberOnly to be compared + /// Instance of ArrayOfNumberOnly to be compared /// Boolean - public bool Equals(ArrayOfNumberOnly other) + public bool Equals(ArrayOfNumberOnly input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.ArrayNumber == other.ArrayNumber || + this.ArrayNumber == input.ArrayNumber || this.ArrayNumber != null && - this.ArrayNumber.SequenceEqual(other.ArrayNumber) + this.ArrayNumber.SequenceEqual(input.ArrayNumber) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.ArrayNumber != null) - hash = hash * 59 + this.ArrayNumber.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.ArrayNumber.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayTest.cs index 36f253aa2259..f1e32b23b9cb 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ArrayTest.cs @@ -86,40 +86,38 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ArrayTest); + return this.Equals(input as ArrayTest); } /// /// Returns true if ArrayTest instances are equal /// - /// Instance of ArrayTest to be compared + /// Instance of ArrayTest to be compared /// Boolean - public bool Equals(ArrayTest other) + public bool Equals(ArrayTest input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.ArrayOfString == other.ArrayOfString || + this.ArrayOfString == input.ArrayOfString || this.ArrayOfString != null && - this.ArrayOfString.SequenceEqual(other.ArrayOfString) + this.ArrayOfString.SequenceEqual(input.ArrayOfString) ) && ( - this.ArrayArrayOfInteger == other.ArrayArrayOfInteger || + this.ArrayArrayOfInteger == input.ArrayArrayOfInteger || this.ArrayArrayOfInteger != null && - this.ArrayArrayOfInteger.SequenceEqual(other.ArrayArrayOfInteger) + this.ArrayArrayOfInteger.SequenceEqual(input.ArrayArrayOfInteger) ) && ( - this.ArrayArrayOfModel == other.ArrayArrayOfModel || + this.ArrayArrayOfModel == input.ArrayArrayOfModel || this.ArrayArrayOfModel != null && - this.ArrayArrayOfModel.SequenceEqual(other.ArrayArrayOfModel) + this.ArrayArrayOfModel.SequenceEqual(input.ArrayArrayOfModel) ); } @@ -129,18 +127,16 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.ArrayOfString != null) - hash = hash * 59 + this.ArrayOfString.GetHashCode(); + hashCode = hashCode * 59 + this.ArrayOfString.GetHashCode(); if (this.ArrayArrayOfInteger != null) - hash = hash * 59 + this.ArrayArrayOfInteger.GetHashCode(); + hashCode = hashCode * 59 + this.ArrayArrayOfInteger.GetHashCode(); if (this.ArrayArrayOfModel != null) - hash = hash * 59 + this.ArrayArrayOfModel.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.ArrayArrayOfModel.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Capitalization.cs index 82df0116140d..e4a61efdd45b 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Capitalization.cs @@ -114,55 +114,53 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Capitalization); + return this.Equals(input as Capitalization); } /// /// Returns true if Capitalization instances are equal /// - /// Instance of Capitalization to be compared + /// Instance of Capitalization to be compared /// Boolean - public bool Equals(Capitalization other) + public bool Equals(Capitalization input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.SmallCamel == other.SmallCamel || - this.SmallCamel != null && - this.SmallCamel.Equals(other.SmallCamel) + this.SmallCamel == input.SmallCamel || + (this.SmallCamel != null && + this.SmallCamel.Equals(input.SmallCamel)) ) && ( - this.CapitalCamel == other.CapitalCamel || - this.CapitalCamel != null && - this.CapitalCamel.Equals(other.CapitalCamel) + this.CapitalCamel == input.CapitalCamel || + (this.CapitalCamel != null && + this.CapitalCamel.Equals(input.CapitalCamel)) ) && ( - this.SmallSnake == other.SmallSnake || - this.SmallSnake != null && - this.SmallSnake.Equals(other.SmallSnake) + this.SmallSnake == input.SmallSnake || + (this.SmallSnake != null && + this.SmallSnake.Equals(input.SmallSnake)) ) && ( - this.CapitalSnake == other.CapitalSnake || - this.CapitalSnake != null && - this.CapitalSnake.Equals(other.CapitalSnake) + this.CapitalSnake == input.CapitalSnake || + (this.CapitalSnake != null && + this.CapitalSnake.Equals(input.CapitalSnake)) ) && ( - this.SCAETHFlowPoints == other.SCAETHFlowPoints || - this.SCAETHFlowPoints != null && - this.SCAETHFlowPoints.Equals(other.SCAETHFlowPoints) + this.SCAETHFlowPoints == input.SCAETHFlowPoints || + (this.SCAETHFlowPoints != null && + this.SCAETHFlowPoints.Equals(input.SCAETHFlowPoints)) ) && ( - this.ATT_NAME == other.ATT_NAME || - this.ATT_NAME != null && - this.ATT_NAME.Equals(other.ATT_NAME) + this.ATT_NAME == input.ATT_NAME || + (this.ATT_NAME != null && + this.ATT_NAME.Equals(input.ATT_NAME)) ); } @@ -172,24 +170,22 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.SmallCamel != null) - hash = hash * 59 + this.SmallCamel.GetHashCode(); + hashCode = hashCode * 59 + this.SmallCamel.GetHashCode(); if (this.CapitalCamel != null) - hash = hash * 59 + this.CapitalCamel.GetHashCode(); + hashCode = hashCode * 59 + this.CapitalCamel.GetHashCode(); if (this.SmallSnake != null) - hash = hash * 59 + this.SmallSnake.GetHashCode(); + hashCode = hashCode * 59 + this.SmallSnake.GetHashCode(); if (this.CapitalSnake != null) - hash = hash * 59 + this.CapitalSnake.GetHashCode(); + hashCode = hashCode * 59 + this.CapitalSnake.GetHashCode(); if (this.SCAETHFlowPoints != null) - hash = hash * 59 + this.SCAETHFlowPoints.GetHashCode(); + hashCode = hashCode * 59 + this.SCAETHFlowPoints.GetHashCode(); if (this.ATT_NAME != null) - hash = hash * 59 + this.ATT_NAME.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.ATT_NAME.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Cat.cs index c0f502292f85..555746a83fec 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Cat.cs @@ -74,30 +74,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Cat); + return this.Equals(input as Cat); } /// /// Returns true if Cat instances are equal /// - /// Instance of Cat to be compared + /// Instance of Cat to be compared /// Boolean - public bool Equals(Cat other) + public bool Equals(Cat input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; - return base.Equals(other) && + return base.Equals(input) && ( - this.Declawed == other.Declawed || - this.Declawed != null && - this.Declawed.Equals(other.Declawed) + this.Declawed == input.Declawed || + (this.Declawed != null && + this.Declawed.Equals(input.Declawed)) ); } @@ -107,14 +105,12 @@ namespace IO.Swagger.Model /// Hash code public override int GetHashCode() { - // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { - int hash = base.GetHashCode(); - // Suitable nullity checks etc, of course :) + int hashCode = base.GetHashCode(); if (this.Declawed != null) - hash = hash * 59 + this.Declawed.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Declawed.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Category.cs index e705f2923d24..09cee2182e2f 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Category.cs @@ -77,35 +77,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Category); + return this.Equals(input as Category); } /// /// Returns true if Category instances are equal /// - /// Instance of Category to be compared + /// Instance of Category to be compared /// Boolean - public bool Equals(Category other) + public bool Equals(Category input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) ) && ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) ); } @@ -115,16 +113,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); + hashCode = hashCode * 59 + this.Id.GetHashCode(); if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Name.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ClassModel.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ClassModel.cs index 838c4e1df189..db91a825dc2c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ClassModel.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ClassModel); + return this.Equals(input as ClassModel); } /// /// Returns true if ClassModel instances are equal /// - /// Instance of ClassModel to be compared + /// Instance of ClassModel to be compared /// Boolean - public bool Equals(ClassModel other) + public bool Equals(ClassModel input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this._Class == other._Class || - this._Class != null && - this._Class.Equals(other._Class) + this._Class == input._Class || + (this._Class != null && + this._Class.Equals(input._Class)) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this._Class != null) - hash = hash * 59 + this._Class.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this._Class.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Dog.cs index 67eae6ae6ea8..672511560d0e 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Dog.cs @@ -74,30 +74,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Dog); + return this.Equals(input as Dog); } /// /// Returns true if Dog instances are equal /// - /// Instance of Dog to be compared + /// Instance of Dog to be compared /// Boolean - public bool Equals(Dog other) + public bool Equals(Dog input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; - return base.Equals(other) && + return base.Equals(input) && ( - this.Breed == other.Breed || - this.Breed != null && - this.Breed.Equals(other.Breed) + this.Breed == input.Breed || + (this.Breed != null && + this.Breed.Equals(input.Breed)) ); } @@ -107,14 +105,12 @@ namespace IO.Swagger.Model /// Hash code public override int GetHashCode() { - // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { - int hash = base.GetHashCode(); - // Suitable nullity checks etc, of course :) + int hashCode = base.GetHashCode(); if (this.Breed != null) - hash = hash * 59 + this.Breed.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Breed.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumArrays.cs index 5ba20e6f75a4..be00b706541d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumArrays.cs @@ -39,16 +39,20 @@ namespace IO.Swagger.Model /// Enum GreaterThanOrEqualTo for ">=" /// [EnumMember(Value = ">=")] - GreaterThanOrEqualTo, + GreaterThanOrEqualTo = 1, /// /// Enum Dollar for "$" /// [EnumMember(Value = "$")] - Dollar + Dollar = 2 } - + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// @@ -60,20 +64,16 @@ namespace IO.Swagger.Model /// Enum Fish for "fish" /// [EnumMember(Value = "fish")] - Fish, + Fish = 1, /// /// Enum Crab for "crab" /// [EnumMember(Value = "crab")] - Crab + Crab = 2 } - /// - /// Gets or Sets JustSymbol - /// - [DataMember(Name="just_symbol", EmitDefaultValue=false)] - public JustSymbolEnum? JustSymbol { get; set; } + /// /// Gets or Sets ArrayEnum /// @@ -118,35 +118,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as EnumArrays); + return this.Equals(input as EnumArrays); } /// /// Returns true if EnumArrays instances are equal /// - /// Instance of EnumArrays to be compared + /// Instance of EnumArrays to be compared /// Boolean - public bool Equals(EnumArrays other) + public bool Equals(EnumArrays input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.JustSymbol == other.JustSymbol || - this.JustSymbol != null && - this.JustSymbol.Equals(other.JustSymbol) + this.JustSymbol == input.JustSymbol || + (this.JustSymbol != null && + this.JustSymbol.Equals(input.JustSymbol)) ) && ( - this.ArrayEnum == other.ArrayEnum || + this.ArrayEnum == input.ArrayEnum || this.ArrayEnum != null && - this.ArrayEnum.SequenceEqual(other.ArrayEnum) + this.ArrayEnum.SequenceEqual(input.ArrayEnum) ); } @@ -156,16 +154,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.JustSymbol != null) - hash = hash * 59 + this.JustSymbol.GetHashCode(); + hashCode = hashCode * 59 + this.JustSymbol.GetHashCode(); if (this.ArrayEnum != null) - hash = hash * 59 + this.ArrayEnum.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.ArrayEnum.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumClass.cs index 33b2a87cb94c..03e5b134c58d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumClass.cs @@ -33,19 +33,19 @@ namespace IO.Swagger.Model /// Enum Abc for "_abc" /// [EnumMember(Value = "_abc")] - Abc, + Abc = 1, /// /// Enum Efg for "-efg" /// [EnumMember(Value = "-efg")] - Efg, + Efg = 2, /// /// Enum Xyz for "(xyz)" /// [EnumMember(Value = "(xyz)")] - Xyz + Xyz = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumTest.cs index 86bbd995b703..bfa1928e56cf 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/EnumTest.cs @@ -39,21 +39,26 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower, + Lower = 2, /// /// Enum Empty for "" /// [EnumMember(Value = "")] - Empty + Empty = 3 } + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } /// /// Gets or Sets EnumInteger /// @@ -74,6 +79,11 @@ namespace IO.Swagger.Model NUMBER_MINUS_1 = -1 } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// @@ -85,38 +95,33 @@ namespace IO.Swagger.Model /// Enum NUMBER_1_DOT_1 for 1.1 /// [EnumMember(Value = "1.1")] - NUMBER_1_DOT_1, + NUMBER_1_DOT_1 = 1, /// /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 /// [EnumMember(Value = "-1.2")] - NUMBER_MINUS_1_DOT_2 + NUMBER_MINUS_1_DOT_2 = 2 } - /// - /// Gets or Sets EnumString - /// - [DataMember(Name="enum_string", EmitDefaultValue=false)] - public EnumStringEnum? EnumString { get; set; } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// [DataMember(Name="enum_number", EmitDefaultValue=false)] public EnumNumberEnum? EnumNumber { get; set; } /// + /// Gets or Sets OuterEnum + /// + [DataMember(Name="outerEnum", EmitDefaultValue=false)] + public OuterEnum? OuterEnum { get; set; } + /// /// Initializes a new instance of the class. /// /// EnumString. /// EnumInteger. /// EnumNumber. /// OuterEnum. - public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum OuterEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum? OuterEnum = default(OuterEnum?)) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -127,11 +132,6 @@ namespace IO.Swagger.Model - /// - /// Gets or Sets OuterEnum - /// - [DataMember(Name="outerEnum", EmitDefaultValue=false)] - public OuterEnum OuterEnum { get; set; } /// /// Returns the string presentation of the object @@ -161,45 +161,43 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as EnumTest); + return this.Equals(input as EnumTest); } /// /// Returns true if EnumTest instances are equal /// - /// Instance of EnumTest to be compared + /// Instance of EnumTest to be compared /// Boolean - public bool Equals(EnumTest other) + public bool Equals(EnumTest input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.EnumString == other.EnumString || - this.EnumString != null && - this.EnumString.Equals(other.EnumString) + this.EnumString == input.EnumString || + (this.EnumString != null && + this.EnumString.Equals(input.EnumString)) ) && ( - this.EnumInteger == other.EnumInteger || - this.EnumInteger != null && - this.EnumInteger.Equals(other.EnumInteger) + this.EnumInteger == input.EnumInteger || + (this.EnumInteger != null && + this.EnumInteger.Equals(input.EnumInteger)) ) && ( - this.EnumNumber == other.EnumNumber || - this.EnumNumber != null && - this.EnumNumber.Equals(other.EnumNumber) + this.EnumNumber == input.EnumNumber || + (this.EnumNumber != null && + this.EnumNumber.Equals(input.EnumNumber)) ) && ( - this.OuterEnum == other.OuterEnum || - this.OuterEnum != null && - this.OuterEnum.Equals(other.OuterEnum) + this.OuterEnum == input.OuterEnum || + (this.OuterEnum != null && + this.OuterEnum.Equals(input.OuterEnum)) ); } @@ -209,20 +207,18 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.EnumString != null) - hash = hash * 59 + this.EnumString.GetHashCode(); + hashCode = hashCode * 59 + this.EnumString.GetHashCode(); if (this.EnumInteger != null) - hash = hash * 59 + this.EnumInteger.GetHashCode(); + hashCode = hashCode * 59 + this.EnumInteger.GetHashCode(); if (this.EnumNumber != null) - hash = hash * 59 + this.EnumNumber.GetHashCode(); + hashCode = hashCode * 59 + this.EnumNumber.GetHashCode(); if (this.OuterEnum != null) - hash = hash * 59 + this.OuterEnum.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.OuterEnum.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/FormatTest.cs index 3a447d572424..3cbb1b86eff8 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/FormatTest.cs @@ -214,90 +214,88 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as FormatTest); + return this.Equals(input as FormatTest); } /// /// Returns true if FormatTest instances are equal /// - /// Instance of FormatTest to be compared + /// Instance of FormatTest to be compared /// Boolean - public bool Equals(FormatTest other) + public bool Equals(FormatTest input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Integer == other.Integer || - this.Integer != null && - this.Integer.Equals(other.Integer) + this.Integer == input.Integer || + (this.Integer != null && + this.Integer.Equals(input.Integer)) ) && ( - this.Int32 == other.Int32 || - this.Int32 != null && - this.Int32.Equals(other.Int32) + this.Int32 == input.Int32 || + (this.Int32 != null && + this.Int32.Equals(input.Int32)) ) && ( - this.Int64 == other.Int64 || - this.Int64 != null && - this.Int64.Equals(other.Int64) + this.Int64 == input.Int64 || + (this.Int64 != null && + this.Int64.Equals(input.Int64)) ) && ( - this.Number == other.Number || - this.Number != null && - this.Number.Equals(other.Number) + this.Number == input.Number || + (this.Number != null && + this.Number.Equals(input.Number)) ) && ( - this._Float == other._Float || - this._Float != null && - this._Float.Equals(other._Float) + this._Float == input._Float || + (this._Float != null && + this._Float.Equals(input._Float)) ) && ( - this._Double == other._Double || - this._Double != null && - this._Double.Equals(other._Double) + this._Double == input._Double || + (this._Double != null && + this._Double.Equals(input._Double)) ) && ( - this._String == other._String || - this._String != null && - this._String.Equals(other._String) + this._String == input._String || + (this._String != null && + this._String.Equals(input._String)) ) && ( - this._Byte == other._Byte || - this._Byte != null && - this._Byte.Equals(other._Byte) + this._Byte == input._Byte || + (this._Byte != null && + this._Byte.Equals(input._Byte)) ) && ( - this.Binary == other.Binary || - this.Binary != null && - this.Binary.Equals(other.Binary) + this.Binary == input.Binary || + (this.Binary != null && + this.Binary.Equals(input.Binary)) ) && ( - this.Date == other.Date || - this.Date != null && - this.Date.Equals(other.Date) + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) ) && ( - this.DateTime == other.DateTime || - this.DateTime != null && - this.DateTime.Equals(other.DateTime) + this.DateTime == input.DateTime || + (this.DateTime != null && + this.DateTime.Equals(input.DateTime)) ) && ( - this.Uuid == other.Uuid || - this.Uuid != null && - this.Uuid.Equals(other.Uuid) + this.Uuid == input.Uuid || + (this.Uuid != null && + this.Uuid.Equals(input.Uuid)) ) && ( - this.Password == other.Password || - this.Password != null && - this.Password.Equals(other.Password) + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) ); } @@ -307,38 +305,36 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Integer != null) - hash = hash * 59 + this.Integer.GetHashCode(); + hashCode = hashCode * 59 + this.Integer.GetHashCode(); if (this.Int32 != null) - hash = hash * 59 + this.Int32.GetHashCode(); + hashCode = hashCode * 59 + this.Int32.GetHashCode(); if (this.Int64 != null) - hash = hash * 59 + this.Int64.GetHashCode(); + hashCode = hashCode * 59 + this.Int64.GetHashCode(); if (this.Number != null) - hash = hash * 59 + this.Number.GetHashCode(); + hashCode = hashCode * 59 + this.Number.GetHashCode(); if (this._Float != null) - hash = hash * 59 + this._Float.GetHashCode(); + hashCode = hashCode * 59 + this._Float.GetHashCode(); if (this._Double != null) - hash = hash * 59 + this._Double.GetHashCode(); + hashCode = hashCode * 59 + this._Double.GetHashCode(); if (this._String != null) - hash = hash * 59 + this._String.GetHashCode(); + hashCode = hashCode * 59 + this._String.GetHashCode(); if (this._Byte != null) - hash = hash * 59 + this._Byte.GetHashCode(); + hashCode = hashCode * 59 + this._Byte.GetHashCode(); if (this.Binary != null) - hash = hash * 59 + this.Binary.GetHashCode(); + hashCode = hashCode * 59 + this.Binary.GetHashCode(); if (this.Date != null) - hash = hash * 59 + this.Date.GetHashCode(); + hashCode = hashCode * 59 + this.Date.GetHashCode(); if (this.DateTime != null) - hash = hash * 59 + this.DateTime.GetHashCode(); + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); if (this.Uuid != null) - hash = hash * 59 + this.Uuid.GetHashCode(); + hashCode = hashCode * 59 + this.Uuid.GetHashCode(); if (this.Password != null) - hash = hash * 59 + this.Password.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Password.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/HasOnlyReadOnly.cs index b03e05d8c1ba..9eca2f0d5af4 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/HasOnlyReadOnly.cs @@ -74,35 +74,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as HasOnlyReadOnly); + return this.Equals(input as HasOnlyReadOnly); } /// /// Returns true if HasOnlyReadOnly instances are equal /// - /// Instance of HasOnlyReadOnly to be compared + /// Instance of HasOnlyReadOnly to be compared /// Boolean - public bool Equals(HasOnlyReadOnly other) + public bool Equals(HasOnlyReadOnly input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Bar == other.Bar || - this.Bar != null && - this.Bar.Equals(other.Bar) + this.Bar == input.Bar || + (this.Bar != null && + this.Bar.Equals(input.Bar)) ) && ( - this.Foo == other.Foo || - this.Foo != null && - this.Foo.Equals(other.Foo) + this.Foo == input.Foo || + (this.Foo != null && + this.Foo.Equals(input.Foo)) ); } @@ -112,16 +110,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Bar != null) - hash = hash * 59 + this.Bar.GetHashCode(); + hashCode = hashCode * 59 + this.Bar.GetHashCode(); if (this.Foo != null) - hash = hash * 59 + this.Foo.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Foo.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/List.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/List.cs index b703a1399d28..37cbae79e1ab 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/List.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/List.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as List); + return this.Equals(input as List); } /// /// Returns true if List instances are equal /// - /// Instance of List to be compared + /// Instance of List to be compared /// Boolean - public bool Equals(List other) + public bool Equals(List input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this._123List == other._123List || - this._123List != null && - this._123List.Equals(other._123List) + this._123List == input._123List || + (this._123List != null && + this._123List.Equals(input._123List)) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this._123List != null) - hash = hash * 59 + this._123List.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this._123List.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MapTest.cs index e6777d51cee6..e11081ceb9e5 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MapTest.cs @@ -28,7 +28,6 @@ namespace IO.Swagger.Model [DataContract] public partial class MapTest : IEquatable { - /// /// Gets or Sets Inner /// @@ -40,15 +39,16 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower + Lower = 2 } + /// /// Gets or Sets MapOfEnumString /// @@ -98,35 +98,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as MapTest); + return this.Equals(input as MapTest); } /// /// Returns true if MapTest instances are equal /// - /// Instance of MapTest to be compared + /// Instance of MapTest to be compared /// Boolean - public bool Equals(MapTest other) + public bool Equals(MapTest input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.MapMapOfString == other.MapMapOfString || + this.MapMapOfString == input.MapMapOfString || this.MapMapOfString != null && - this.MapMapOfString.SequenceEqual(other.MapMapOfString) + this.MapMapOfString.SequenceEqual(input.MapMapOfString) ) && ( - this.MapOfEnumString == other.MapOfEnumString || + this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && - this.MapOfEnumString.SequenceEqual(other.MapOfEnumString) + this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) ); } @@ -136,16 +134,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.MapMapOfString != null) - hash = hash * 59 + this.MapMapOfString.GetHashCode(); + hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) - hash = hash * 59 + this.MapOfEnumString.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 099c16428d9c..3fa6f8d7d2f5 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -86,40 +86,38 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as MixedPropertiesAndAdditionalPropertiesClass); + return this.Equals(input as MixedPropertiesAndAdditionalPropertiesClass); } /// /// Returns true if MixedPropertiesAndAdditionalPropertiesClass instances are equal /// - /// Instance of MixedPropertiesAndAdditionalPropertiesClass to be compared + /// Instance of MixedPropertiesAndAdditionalPropertiesClass to be compared /// Boolean - public bool Equals(MixedPropertiesAndAdditionalPropertiesClass other) + public bool Equals(MixedPropertiesAndAdditionalPropertiesClass input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Uuid == other.Uuid || - this.Uuid != null && - this.Uuid.Equals(other.Uuid) + this.Uuid == input.Uuid || + (this.Uuid != null && + this.Uuid.Equals(input.Uuid)) ) && ( - this.DateTime == other.DateTime || - this.DateTime != null && - this.DateTime.Equals(other.DateTime) + this.DateTime == input.DateTime || + (this.DateTime != null && + this.DateTime.Equals(input.DateTime)) ) && ( - this.Map == other.Map || + this.Map == input.Map || this.Map != null && - this.Map.SequenceEqual(other.Map) + this.Map.SequenceEqual(input.Map) ); } @@ -129,18 +127,16 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Uuid != null) - hash = hash * 59 + this.Uuid.GetHashCode(); + hashCode = hashCode * 59 + this.Uuid.GetHashCode(); if (this.DateTime != null) - hash = hash * 59 + this.DateTime.GetHashCode(); + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); if (this.Map != null) - hash = hash * 59 + this.Map.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Map.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Model200Response.cs index 645976249c3d..f4647201c720 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Model200Response.cs @@ -77,35 +77,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Model200Response); + return this.Equals(input as Model200Response); } /// /// Returns true if Model200Response instances are equal /// - /// Instance of Model200Response to be compared + /// Instance of Model200Response to be compared /// Boolean - public bool Equals(Model200Response other) + public bool Equals(Model200Response input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) ) && ( - this._Class == other._Class || - this._Class != null && - this._Class.Equals(other._Class) + this._Class == input._Class || + (this._Class != null && + this._Class.Equals(input._Class)) ); } @@ -115,16 +113,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); + hashCode = hashCode * 59 + this.Name.GetHashCode(); if (this._Class != null) - hash = hash * 59 + this._Class.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this._Class.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelClient.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelClient.cs index 4fe4bd210aab..863a2a438d16 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelClient.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ModelClient); + return this.Equals(input as ModelClient); } /// /// Returns true if ModelClient instances are equal /// - /// Instance of ModelClient to be compared + /// Instance of ModelClient to be compared /// Boolean - public bool Equals(ModelClient other) + public bool Equals(ModelClient input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this._Client == other._Client || - this._Client != null && - this._Client.Equals(other._Client) + this._Client == input._Client || + (this._Client != null && + this._Client.Equals(input._Client)) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this._Client != null) - hash = hash * 59 + this._Client.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this._Client.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelReturn.cs index e53a25cfbc9f..0e031e3ee47e 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ModelReturn.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ModelReturn); + return this.Equals(input as ModelReturn); } /// /// Returns true if ModelReturn instances are equal /// - /// Instance of ModelReturn to be compared + /// Instance of ModelReturn to be compared /// Boolean - public bool Equals(ModelReturn other) + public bool Equals(ModelReturn input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this._Return == other._Return || - this._Return != null && - this._Return.Equals(other._Return) + this._Return == input._Return || + (this._Return != null && + this._Return.Equals(input._Return)) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this._Return != null) - hash = hash * 59 + this._Return.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this._Return.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Name.cs index 472df10fb4bf..cece286486fd 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Name.cs @@ -104,45 +104,43 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Name); + return this.Equals(input as Name); } /// /// Returns true if Name instances are equal /// - /// Instance of Name to be compared + /// Instance of Name to be compared /// Boolean - public bool Equals(Name other) + public bool Equals(Name input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this._Name == other._Name || - this._Name != null && - this._Name.Equals(other._Name) + this._Name == input._Name || + (this._Name != null && + this._Name.Equals(input._Name)) ) && ( - this.SnakeCase == other.SnakeCase || - this.SnakeCase != null && - this.SnakeCase.Equals(other.SnakeCase) + this.SnakeCase == input.SnakeCase || + (this.SnakeCase != null && + this.SnakeCase.Equals(input.SnakeCase)) ) && ( - this.Property == other.Property || - this.Property != null && - this.Property.Equals(other.Property) + this.Property == input.Property || + (this.Property != null && + this.Property.Equals(input.Property)) ) && ( - this._123Number == other._123Number || - this._123Number != null && - this._123Number.Equals(other._123Number) + this._123Number == input._123Number || + (this._123Number != null && + this._123Number.Equals(input._123Number)) ); } @@ -152,20 +150,18 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this._Name != null) - hash = hash * 59 + this._Name.GetHashCode(); + hashCode = hashCode * 59 + this._Name.GetHashCode(); if (this.SnakeCase != null) - hash = hash * 59 + this.SnakeCase.GetHashCode(); + hashCode = hashCode * 59 + this.SnakeCase.GetHashCode(); if (this.Property != null) - hash = hash * 59 + this.Property.GetHashCode(); + hashCode = hashCode * 59 + this.Property.GetHashCode(); if (this._123Number != null) - hash = hash * 59 + this._123Number.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this._123Number.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/NumberOnly.cs index bdde2701e685..7736b087c7b3 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/NumberOnly.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as NumberOnly); + return this.Equals(input as NumberOnly); } /// /// Returns true if NumberOnly instances are equal /// - /// Instance of NumberOnly to be compared + /// Instance of NumberOnly to be compared /// Boolean - public bool Equals(NumberOnly other) + public bool Equals(NumberOnly input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.JustNumber == other.JustNumber || - this.JustNumber != null && - this.JustNumber.Equals(other.JustNumber) + this.JustNumber == input.JustNumber || + (this.JustNumber != null && + this.JustNumber.Equals(input.JustNumber)) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.JustNumber != null) - hash = hash * 59 + this.JustNumber.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.JustNumber.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Order.cs index 351e0e1ecccb..b29d4d8f077d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Order.cs @@ -40,19 +40,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } /// @@ -149,55 +149,53 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Order); + return this.Equals(input as Order); } /// /// Returns true if Order instances are equal /// - /// Instance of Order to be compared + /// Instance of Order to be compared /// Boolean - public bool Equals(Order other) + public bool Equals(Order input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) ) && ( - this.PetId == other.PetId || - this.PetId != null && - this.PetId.Equals(other.PetId) + this.PetId == input.PetId || + (this.PetId != null && + this.PetId.Equals(input.PetId)) ) && ( - this.Quantity == other.Quantity || - this.Quantity != null && - this.Quantity.Equals(other.Quantity) + this.Quantity == input.Quantity || + (this.Quantity != null && + this.Quantity.Equals(input.Quantity)) ) && ( - this.ShipDate == other.ShipDate || - this.ShipDate != null && - this.ShipDate.Equals(other.ShipDate) + this.ShipDate == input.ShipDate || + (this.ShipDate != null && + this.ShipDate.Equals(input.ShipDate)) ) && ( - this.Status == other.Status || - this.Status != null && - this.Status.Equals(other.Status) + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) ) && ( - this.Complete == other.Complete || - this.Complete != null && - this.Complete.Equals(other.Complete) + this.Complete == input.Complete || + (this.Complete != null && + this.Complete.Equals(input.Complete)) ); } @@ -207,24 +205,22 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); + hashCode = hashCode * 59 + this.Id.GetHashCode(); if (this.PetId != null) - hash = hash * 59 + this.PetId.GetHashCode(); + hashCode = hashCode * 59 + this.PetId.GetHashCode(); if (this.Quantity != null) - hash = hash * 59 + this.Quantity.GetHashCode(); + hashCode = hashCode * 59 + this.Quantity.GetHashCode(); if (this.ShipDate != null) - hash = hash * 59 + this.ShipDate.GetHashCode(); + hashCode = hashCode * 59 + this.ShipDate.GetHashCode(); if (this.Status != null) - hash = hash * 59 + this.Status.GetHashCode(); + hashCode = hashCode * 59 + this.Status.GetHashCode(); if (this.Complete != null) - hash = hash * 59 + this.Complete.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Complete.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterBoolean.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterBoolean.cs similarity index 79% rename from samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterBoolean.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterBoolean.cs index 54f81745c240..72368984bb85 100644 --- a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterBoolean.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterBoolean.cs @@ -18,6 +18,7 @@ using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter; namespace IO.Swagger.Model { @@ -59,23 +60,21 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as OuterBoolean); + return this.Equals(input as OuterBoolean); } /// /// Returns true if OuterBoolean instances are equal /// - /// Instance of OuterBoolean to be compared + /// Instance of OuterBoolean to be compared /// Boolean - public bool Equals(OuterBoolean other) + public bool Equals(OuterBoolean input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return false; @@ -87,12 +86,10 @@ namespace IO.Swagger.Model /// 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 :) - return hash; + int hashCode = 41; + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterComposite.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterComposite.cs similarity index 74% rename from samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterComposite.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterComposite.cs index 308c26d4f5c0..084db10819a2 100644 --- a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterComposite.cs @@ -18,6 +18,7 @@ using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter; namespace IO.Swagger.Model { @@ -45,16 +46,19 @@ namespace IO.Swagger.Model /// [DataMember(Name="my_number", EmitDefaultValue=false)] public OuterNumber MyNumber { get; set; } + /// /// Gets or Sets MyString /// [DataMember(Name="my_string", EmitDefaultValue=false)] public OuterString MyString { get; set; } + /// /// Gets or Sets MyBoolean /// [DataMember(Name="my_boolean", EmitDefaultValue=false)] public OuterBoolean MyBoolean { get; set; } + /// /// Returns the string presentation of the object /// @@ -82,40 +86,38 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as OuterComposite); + return this.Equals(input as OuterComposite); } /// /// Returns true if OuterComposite instances are equal /// - /// Instance of OuterComposite to be compared + /// Instance of OuterComposite to be compared /// Boolean - public bool Equals(OuterComposite other) + public bool Equals(OuterComposite input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.MyNumber == other.MyNumber || - this.MyNumber != null && - this.MyNumber.Equals(other.MyNumber) + this.MyNumber == input.MyNumber || + (this.MyNumber != null && + this.MyNumber.Equals(input.MyNumber)) ) && ( - this.MyString == other.MyString || - this.MyString != null && - this.MyString.Equals(other.MyString) + this.MyString == input.MyString || + (this.MyString != null && + this.MyString.Equals(input.MyString)) ) && ( - this.MyBoolean == other.MyBoolean || - this.MyBoolean != null && - this.MyBoolean.Equals(other.MyBoolean) + this.MyBoolean == input.MyBoolean || + (this.MyBoolean != null && + this.MyBoolean.Equals(input.MyBoolean)) ); } @@ -125,18 +127,16 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.MyNumber != null) - hash = hash * 59 + this.MyNumber.GetHashCode(); + hashCode = hashCode * 59 + this.MyNumber.GetHashCode(); if (this.MyString != null) - hash = hash * 59 + this.MyString.GetHashCode(); + hashCode = hashCode * 59 + this.MyString.GetHashCode(); if (this.MyBoolean != null) - hash = hash * 59 + this.MyBoolean.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.MyBoolean.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterEnum.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterEnum.cs index 7155b03d7d50..4ef77777ee54 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterEnum.cs @@ -33,19 +33,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterNumber.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterNumber.cs similarity index 79% rename from samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterNumber.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterNumber.cs index 103fd4f69dd3..a9317a3a9f33 100644 --- a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterNumber.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterNumber.cs @@ -18,6 +18,7 @@ using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter; namespace IO.Swagger.Model { @@ -59,23 +60,21 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as OuterNumber); + return this.Equals(input as OuterNumber); } /// /// Returns true if OuterNumber instances are equal /// - /// Instance of OuterNumber to be compared + /// Instance of OuterNumber to be compared /// Boolean - public bool Equals(OuterNumber other) + public bool Equals(OuterNumber input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return false; @@ -87,12 +86,10 @@ namespace IO.Swagger.Model /// 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 :) - return hash; + int hashCode = 41; + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterString.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterString.cs similarity index 79% rename from samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterString.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterString.cs index 327fe620b59b..3b7c5e6c9315 100644 --- a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterString.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterString.cs @@ -18,6 +18,7 @@ using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter; namespace IO.Swagger.Model { @@ -59,23 +60,21 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as OuterString); + return this.Equals(input as OuterString); } /// /// Returns true if OuterString instances are equal /// - /// Instance of OuterString to be compared + /// Instance of OuterString to be compared /// Boolean - public bool Equals(OuterString other) + public bool Equals(OuterString input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return false; @@ -87,12 +86,10 @@ namespace IO.Swagger.Model /// 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 :) - return hash; + int hashCode = 41; + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Pet.cs index b794f6b1f4ca..1deebed8f3b6 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Pet.cs @@ -40,19 +40,19 @@ namespace IO.Swagger.Model /// Enum Available for "available" /// [EnumMember(Value = "available")] - Available, + Available = 1, /// /// Enum Pending for "pending" /// [EnumMember(Value = "pending")] - Pending, + Pending = 2, /// /// Enum Sold for "sold" /// [EnumMember(Value = "sold")] - Sold + Sold = 3 } /// @@ -162,55 +162,53 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Pet); + return this.Equals(input as Pet); } /// /// Returns true if Pet instances are equal /// - /// Instance of Pet to be compared + /// Instance of Pet to be compared /// Boolean - public bool Equals(Pet other) + public bool Equals(Pet input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) ) && ( - this.Category == other.Category || - this.Category != null && - this.Category.Equals(other.Category) + this.Category == input.Category || + (this.Category != null && + this.Category.Equals(input.Category)) ) && ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) ) && ( - this.PhotoUrls == other.PhotoUrls || + this.PhotoUrls == input.PhotoUrls || this.PhotoUrls != null && - this.PhotoUrls.SequenceEqual(other.PhotoUrls) + this.PhotoUrls.SequenceEqual(input.PhotoUrls) ) && ( - this.Tags == other.Tags || + this.Tags == input.Tags || this.Tags != null && - this.Tags.SequenceEqual(other.Tags) + this.Tags.SequenceEqual(input.Tags) ) && ( - this.Status == other.Status || - this.Status != null && - this.Status.Equals(other.Status) + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) ); } @@ -220,24 +218,22 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); + hashCode = hashCode * 59 + this.Id.GetHashCode(); if (this.Category != null) - hash = hash * 59 + this.Category.GetHashCode(); + hashCode = hashCode * 59 + this.Category.GetHashCode(); if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); + hashCode = hashCode * 59 + this.Name.GetHashCode(); if (this.PhotoUrls != null) - hash = hash * 59 + this.PhotoUrls.GetHashCode(); + hashCode = hashCode * 59 + this.PhotoUrls.GetHashCode(); if (this.Tags != null) - hash = hash * 59 + this.Tags.GetHashCode(); + hashCode = hashCode * 59 + this.Tags.GetHashCode(); if (this.Status != null) - hash = hash * 59 + this.Status.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Status.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ReadOnlyFirst.cs index 27492adc54ba..73e33ae3d4fa 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/ReadOnlyFirst.cs @@ -75,35 +75,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ReadOnlyFirst); + return this.Equals(input as ReadOnlyFirst); } /// /// Returns true if ReadOnlyFirst instances are equal /// - /// Instance of ReadOnlyFirst to be compared + /// Instance of ReadOnlyFirst to be compared /// Boolean - public bool Equals(ReadOnlyFirst other) + public bool Equals(ReadOnlyFirst input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Bar == other.Bar || - this.Bar != null && - this.Bar.Equals(other.Bar) + this.Bar == input.Bar || + (this.Bar != null && + this.Bar.Equals(input.Bar)) ) && ( - this.Baz == other.Baz || - this.Baz != null && - this.Baz.Equals(other.Baz) + this.Baz == input.Baz || + (this.Baz != null && + this.Baz.Equals(input.Baz)) ); } @@ -113,16 +111,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Bar != null) - hash = hash * 59 + this.Bar.GetHashCode(); + hashCode = hashCode * 59 + this.Bar.GetHashCode(); if (this.Baz != null) - hash = hash * 59 + this.Baz.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Baz.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/SpecialModelName.cs index f6ca2850cd93..5f412aa11353 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/SpecialModelName.cs @@ -68,30 +68,28 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as SpecialModelName); + return this.Equals(input as SpecialModelName); } /// /// Returns true if SpecialModelName instances are equal /// - /// Instance of SpecialModelName to be compared + /// Instance of SpecialModelName to be compared /// Boolean - public bool Equals(SpecialModelName other) + public bool Equals(SpecialModelName input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.SpecialPropertyName == other.SpecialPropertyName || - this.SpecialPropertyName != null && - this.SpecialPropertyName.Equals(other.SpecialPropertyName) + this.SpecialPropertyName == input.SpecialPropertyName || + (this.SpecialPropertyName != null && + this.SpecialPropertyName.Equals(input.SpecialPropertyName)) ); } @@ -101,14 +99,12 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.SpecialPropertyName != null) - hash = hash * 59 + this.SpecialPropertyName.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.SpecialPropertyName.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Tag.cs index 779a0c0d07fb..0207cb981f03 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/Tag.cs @@ -77,35 +77,33 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Tag); + return this.Equals(input as Tag); } /// /// Returns true if Tag instances are equal /// - /// Instance of Tag to be compared + /// Instance of Tag to be compared /// Boolean - public bool Equals(Tag other) + public bool Equals(Tag input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) ) && ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) ); } @@ -115,16 +113,14 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); + hashCode = hashCode * 59 + this.Id.GetHashCode(); if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.Name.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/User.cs index 669622d26138..c56c8cd1aa03 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/User.cs @@ -132,65 +132,63 @@ namespace IO.Swagger.Model /// /// Returns true if objects are equal /// - /// Object to be compared + /// Object to be compared /// Boolean - public override bool Equals(object obj) + public override bool Equals(object input) { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as User); + return this.Equals(input as User); } /// /// Returns true if User instances are equal /// - /// Instance of User to be compared + /// Instance of User to be compared /// Boolean - public bool Equals(User other) + public bool Equals(User input) { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) + if (input == null) return false; return ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) ) && ( - this.Username == other.Username || - this.Username != null && - this.Username.Equals(other.Username) + this.Username == input.Username || + (this.Username != null && + this.Username.Equals(input.Username)) ) && ( - this.FirstName == other.FirstName || - this.FirstName != null && - this.FirstName.Equals(other.FirstName) + this.FirstName == input.FirstName || + (this.FirstName != null && + this.FirstName.Equals(input.FirstName)) ) && ( - this.LastName == other.LastName || - this.LastName != null && - this.LastName.Equals(other.LastName) + this.LastName == input.LastName || + (this.LastName != null && + this.LastName.Equals(input.LastName)) ) && ( - this.Email == other.Email || - this.Email != null && - this.Email.Equals(other.Email) + this.Email == input.Email || + (this.Email != null && + this.Email.Equals(input.Email)) ) && ( - this.Password == other.Password || - this.Password != null && - this.Password.Equals(other.Password) + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) ) && ( - this.Phone == other.Phone || - this.Phone != null && - this.Phone.Equals(other.Phone) + this.Phone == input.Phone || + (this.Phone != null && + this.Phone.Equals(input.Phone)) ) && ( - this.UserStatus == other.UserStatus || - this.UserStatus != null && - this.UserStatus.Equals(other.UserStatus) + this.UserStatus == input.UserStatus || + (this.UserStatus != null && + this.UserStatus.Equals(input.UserStatus)) ); } @@ -200,28 +198,26 @@ namespace IO.Swagger.Model /// 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 :) + int hashCode = 41; if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); + hashCode = hashCode * 59 + this.Id.GetHashCode(); if (this.Username != null) - hash = hash * 59 + this.Username.GetHashCode(); + hashCode = hashCode * 59 + this.Username.GetHashCode(); if (this.FirstName != null) - hash = hash * 59 + this.FirstName.GetHashCode(); + hashCode = hashCode * 59 + this.FirstName.GetHashCode(); if (this.LastName != null) - hash = hash * 59 + this.LastName.GetHashCode(); + hashCode = hashCode * 59 + this.LastName.GetHashCode(); if (this.Email != null) - hash = hash * 59 + this.Email.GetHashCode(); + hashCode = hashCode * 59 + this.Email.GetHashCode(); if (this.Password != null) - hash = hash * 59 + this.Password.GetHashCode(); + hashCode = hashCode * 59 + this.Password.GetHashCode(); if (this.Phone != null) - hash = hash * 59 + this.Phone.GetHashCode(); + hashCode = hashCode * 59 + this.Phone.GetHashCode(); if (this.UserStatus != null) - hash = hash * 59 + this.UserStatus.GetHashCode(); - return hash; + hashCode = hashCode * 59 + this.UserStatus.GetHashCode(); + return hashCode; } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClientNetStandard/IO.Swagger.sln index 9e432f73cbe2..0280476fafc2 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{3AB1F259-1769-484B-9411-84505FCCBD55}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,10 +10,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.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/SwaggerClientNetStandard/README.md b/samples/client/petstore/csharp/SwaggerClientNetStandard/README.md index 5efd0ff674ec..0e226b9c0e63 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/README.md +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/README.md @@ -19,7 +19,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c ## Dependencies - FubarCoder.RestSharp.Portable.Core >=4.0.7 - FubarCoder.RestSharp.Portable.HttpClient >=4.0.7 -- Newtonsoft.Json >=9.0.1 +- Newtonsoft.Json >=10.0.3 ## Installation diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClientNetStandard/docs/EnumTest.md index a4371a966956..5b38bb5b3a58 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/docs/EnumTest.md +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/docs/EnumTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **EnumString** | **string** | | [optional] **EnumInteger** | **int?** | | [optional] **EnumNumber** | **double?** | | [optional] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**OuterEnum** | **OuterEnum** | | [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/SwaggerClientNetStandard/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientNetStandard/docs/Fake_classname_tags123Api.md deleted file mode 100644 index d79ca65f1f94..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/docs/Fake_classname_tags123Api.md +++ /dev/null @@ -1,73 +0,0 @@ -# IO.Swagger.Api.Fake_classname_tags123Api - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**TestClassname**](Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case - - - -# **TestClassname** -> ModelClient TestClassname (ModelClient body) - -To test class name in snake case - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class TestClassnameExample - { - public void main() - { - // Configure API key authorization: api_key_query - Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY"); - // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); - - var apiInstance = new Fake_classname_tags123Api(); - var body = new ModelClient(); // ModelClient | client model - - try - { - // To test class name in snake case - ModelClient result = apiInstance.TestClassname(body); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling Fake_classname_tags123Api.TestClassname: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -[api_key_query](../README.md#api_key_query) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/git_push.sh b/samples/client/petstore/csharp/SwaggerClientNetStandard/git_push.sh index 792320114fbe..160f6f213999 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/JsonSubTypes.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/JsonSubTypes.cs deleted file mode 100644 index 3a6da091b781..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/JsonSubTypes.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer.GenericTypeArguments[0]; - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType.GetTypeInfo().GetCustomAttributes()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType.GetTypeInfo().Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(IReadOnlyDictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type.GetTypeInfo().GetCustomAttributes().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType.GetTypeInfo().IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj index 528dccbf15c2..303c8daa0e9c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj @@ -12,7 +12,7 @@ Contact: apiteam@swagger.io 14.0 Debug AnyCPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C} + {3AB1F259-1769-484B-9411-84505FCCBD55} Library Properties IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumArrays.cs index 28bbb15ea784..be00b706541d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumArrays.cs @@ -39,16 +39,20 @@ namespace IO.Swagger.Model /// Enum GreaterThanOrEqualTo for ">=" /// [EnumMember(Value = ">=")] - GreaterThanOrEqualTo, + GreaterThanOrEqualTo = 1, /// /// Enum Dollar for "$" /// [EnumMember(Value = "$")] - Dollar + Dollar = 2 } - + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// @@ -60,20 +64,16 @@ namespace IO.Swagger.Model /// Enum Fish for "fish" /// [EnumMember(Value = "fish")] - Fish, + Fish = 1, /// /// Enum Crab for "crab" /// [EnumMember(Value = "crab")] - Crab + Crab = 2 } - /// - /// Gets or Sets JustSymbol - /// - [DataMember(Name="just_symbol", EmitDefaultValue=false)] - public JustSymbolEnum? JustSymbol { get; set; } + /// /// Gets or Sets ArrayEnum /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumClass.cs index 33b2a87cb94c..03e5b134c58d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumClass.cs @@ -33,19 +33,19 @@ namespace IO.Swagger.Model /// Enum Abc for "_abc" /// [EnumMember(Value = "_abc")] - Abc, + Abc = 1, /// /// Enum Efg for "-efg" /// [EnumMember(Value = "-efg")] - Efg, + Efg = 2, /// /// Enum Xyz for "(xyz)" /// [EnumMember(Value = "(xyz)")] - Xyz + Xyz = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumTest.cs index c5385e5ae29f..bfa1928e56cf 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/EnumTest.cs @@ -39,21 +39,26 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower, + Lower = 2, /// /// Enum Empty for "" /// [EnumMember(Value = "")] - Empty + Empty = 3 } + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } /// /// Gets or Sets EnumInteger /// @@ -74,6 +79,11 @@ namespace IO.Swagger.Model NUMBER_MINUS_1 = -1 } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// @@ -85,38 +95,33 @@ namespace IO.Swagger.Model /// Enum NUMBER_1_DOT_1 for 1.1 /// [EnumMember(Value = "1.1")] - NUMBER_1_DOT_1, + NUMBER_1_DOT_1 = 1, /// /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 /// [EnumMember(Value = "-1.2")] - NUMBER_MINUS_1_DOT_2 + NUMBER_MINUS_1_DOT_2 = 2 } - /// - /// Gets or Sets EnumString - /// - [DataMember(Name="enum_string", EmitDefaultValue=false)] - public EnumStringEnum? EnumString { get; set; } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// [DataMember(Name="enum_number", EmitDefaultValue=false)] public EnumNumberEnum? EnumNumber { get; set; } /// + /// Gets or Sets OuterEnum + /// + [DataMember(Name="outerEnum", EmitDefaultValue=false)] + public OuterEnum? OuterEnum { get; set; } + /// /// Initializes a new instance of the class. /// /// EnumString. /// EnumInteger. /// EnumNumber. /// OuterEnum. - public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum OuterEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum? OuterEnum = default(OuterEnum?)) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -127,11 +132,6 @@ namespace IO.Swagger.Model - /// - /// Gets or Sets OuterEnum - /// - [DataMember(Name="outerEnum", EmitDefaultValue=false)] - public OuterEnum OuterEnum { get; set; } /// /// Returns the string presentation of the object diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/MapTest.cs index 42ee91a79cfa..e11081ceb9e5 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/MapTest.cs @@ -28,7 +28,6 @@ namespace IO.Swagger.Model [DataContract] public partial class MapTest : IEquatable { - /// /// Gets or Sets Inner /// @@ -40,15 +39,16 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower + Lower = 2 } + /// /// Gets or Sets MapOfEnumString /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Order.cs index 13b3cdf6fc63..b29d4d8f077d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Order.cs @@ -40,19 +40,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/OuterEnum.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/OuterEnum.cs index 7155b03d7d50..4ef77777ee54 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/OuterEnum.cs @@ -33,19 +33,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Pet.cs index ef434ebe581f..1deebed8f3b6 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Model/Pet.cs @@ -40,19 +40,19 @@ namespace IO.Swagger.Model /// Enum Available for "available" /// [EnumMember(Value = "available")] - Available, + Available = 1, /// /// Enum Pending for "pending" /// [EnumMember(Value = "pending")] - Pending, + Pending = 2, /// /// Enum Sold for "sold" /// [EnumMember(Value = "sold")] - Sold + Sold = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/project.json b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/project.json index 66cf3ab152c2..5cca819085fd 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/project.json +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/project.json @@ -3,7 +3,8 @@ "dependencies": { "FubarCoder.RestSharp.Portable.Core": "4.0.7", "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", - "Newtonsoft.Json": "9.0.1" + "Newtonsoft.Json": "10.0.3", + "JsonSubTypes": "1.1.3" }, "frameworks": { "netstandard1.3": {} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/TestResult.xml b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/TestResult.xml deleted file mode 100644 index 08369e4ca737..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/TestResult.xml +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/EnumTest.md index a4371a966956..5b38bb5b3a58 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/EnumTest.md +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/EnumTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **EnumString** | **string** | | [optional] **EnumInteger** | **int?** | | [optional] **EnumNumber** | **double?** | | [optional] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**OuterEnum** | **OuterEnum** | | [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/SwaggerClientWithPropertyChanged/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Fake_classname_tags123Api.md deleted file mode 100644 index d79ca65f1f94..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Fake_classname_tags123Api.md +++ /dev/null @@ -1,73 +0,0 @@ -# IO.Swagger.Api.Fake_classname_tags123Api - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**TestClassname**](Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case - - - -# **TestClassname** -> ModelClient TestClassname (ModelClient body) - -To test class name in snake case - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class TestClassnameExample - { - public void main() - { - // Configure API key authorization: api_key_query - Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY"); - // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); - - var apiInstance = new Fake_classname_tags123Api(); - var body = new ModelClient(); // ModelClient | client model - - try - { - // To test class name in snake case - ModelClient result = apiInstance.TestClassname(body); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling Fake_classname_tags123Api.TestClassname: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -[api_key_query](../README.md#api_key_query) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/git_push.sh b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/git_push.sh index 792320114fbe..160f6f213999 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/nuget.exe b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/nuget.exe deleted file mode 100644 index 324daa842c51..000000000000 Binary files a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/nuget.exe and /dev/null differ diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/FakeApiTests.cs index 7922d898fdda..fc21272e659a 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -6,18 +6,6 @@ * 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; @@ -76,6 +64,54 @@ namespace IO.Swagger.Test } + /// + /// Test FakeOuterBooleanSerialize + /// + [Test] + public void FakeOuterBooleanSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterBoolean body = null; + //var response = instance.FakeOuterBooleanSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterBoolean"); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Test] + public void FakeOuterCompositeSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterComposite body = null; + //var response = instance.FakeOuterCompositeSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterComposite"); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Test] + public void FakeOuterNumberSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterNumber body = null; + //var response = instance.FakeOuterNumberSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterNumber"); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Test] + public void FakeOuterStringSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterString body = null; + //var response = instance.FakeOuterStringSerialize(body); + //Assert.IsInstanceOf (response, "response is OuterString"); + } + /// /// Test TestClientModel /// @@ -108,7 +144,8 @@ namespace IO.Swagger.Test //DateTime? date = null; //DateTime? dateTime = null; //string password = null; - //instance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password); + //string callback = null; + //instance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -125,12 +162,37 @@ namespace IO.Swagger.Test //string enumHeaderString = null; //List enumQueryStringArray = null; //string enumQueryString = null; - //decimal? enumQueryInteger = null; + //int? enumQueryInteger = null; //double? enumQueryDouble = null; //instance.TestEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } + /// + /// Test TestInlineAdditionalProperties + /// + [Test] + public void TestInlineAdditionalPropertiesTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Object param = null; + //instance.TestInlineAdditionalProperties(param); + + } + + /// + /// Test TestJsonFormData + /// + [Test] + public void TestJsonFormDataTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string param = null; + //string param2 = null; + //instance.TestJsonFormData(param, param2); + + } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs deleted file mode 100644 index 2b08417f7db8..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 - */ - -using System; -using System.IO; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using RestSharp; -using NUnit.Framework; - -using IO.Swagger.Client; -using IO.Swagger.Api; -using IO.Swagger.Model; - -namespace IO.Swagger.Test -{ - /// - /// Class for testing Fake_classname_tags123Api - /// - /// - /// This file is automatically generated by Swagger Codegen. - /// Please update the test case below to test the API endpoint. - /// - [TestFixture] - public class Fake_classname_tags123ApiTests - { - private Fake_classname_tags123Api instance; - - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() - { - instance = new Fake_classname_tags123Api(); - } - - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - - /// - /// Test an instance of Fake_classname_tags123Api - /// - [Test] - public void InstanceTest() - { - // TODO uncomment below to test 'IsInstanceOfType' Fake_classname_tags123Api - //Assert.IsInstanceOfType(typeof(Fake_classname_tags123Api), instance, "instance is a Fake_classname_tags123Api"); - } - - - /// - /// Test TestClassname - /// - [Test] - public void TestClassnameTest() - { - // TODO uncomment below to test the method and replace null with proper value - //ModelClient body = null; - //var response = instance.TestClassname(body); - //Assert.IsInstanceOf (response, "response is ModelClient"); - } - - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/PetApiTests.cs index a512676b08c5..34c1fb71f44c 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/PetApiTests.cs @@ -6,18 +6,6 @@ * 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; diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/StoreApiTests.cs index b7de1d862dcf..005bf9f0315c 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/StoreApiTests.cs @@ -6,18 +6,6 @@ * 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; diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/UserApiTests.cs index ff5fdf17ad82..e119bb85c226 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/UserApiTests.cs @@ -6,18 +6,6 @@ * 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; diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 6dd03871c7c4..20ea398f9749 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -52,6 +52,12 @@ Contact: apiteam@swagger.io ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs index bec025d50645..60b6cee9f538 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a AdditionalPropertiesClass"); } + /// /// Test the property 'MapProperty' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalFarmTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalFarmTests.cs index 6d0c4652992b..6fa7b87485a7 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalFarmTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalFarmTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -77,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalTests.cs index e877b597a37d..ba3786457af8 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/AnimalTests.cs @@ -6,18 +6,6 @@ * 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. */ diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ApiResponseTests.cs index af03fac80713..8a5649b4676b 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ApiResponseTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ApiResponseTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ApiResponse"); } + /// /// Test the property 'Code' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs index 18d4bf16cdac..3f8f100a7f58 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly"); } + /// /// Test the property 'ArrayArrayNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs index 5a91f3736da2..28a540e676ba 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfNumberOnly"); } + /// /// Test the property 'ArrayNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayTestTests.cs index 4c50d7166f5a..09864b81ac2a 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ArrayTestTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayTest"); } + /// /// Test the property 'ArrayOfString' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs index 30ed8700f748..fe7637ded78c 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization"); } + /// /// Test the property 'SmallCamel' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CatTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CatTests.cs index b0a9047dde52..d79719efdbc3 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CatTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,22 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Cat"); } - /// - /// Test the property 'ClassName' - /// - [Test] - public void ClassNameTest() - { - // TODO unit test for the property 'ClassName' - } - /// - /// Test the property 'Color' - /// - [Test] - public void ColorTest() - { - // TODO unit test for the property 'Color' - } + /// /// Test the property 'Declawed' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CategoryTests.cs index f8940cdbc832..13497ed1fd69 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CategoryTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Category"); } + /// /// Test the property 'Id' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ClassModelTests.cs index 01b2c5b9c1b6..2589ea4ecea7 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ClassModelTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ClassModelTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ClassModel"); } + /// /// Test the property '_Class' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/DogTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/DogTests.cs index ba429c0b2421..3f47e42e8c27 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/DogTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/DogTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,22 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Dog"); } - /// - /// Test the property 'ClassName' - /// - [Test] - public void ClassNameTest() - { - // TODO unit test for the property 'ClassName' - } - /// - /// Test the property 'Color' - /// - [Test] - public void ColorTest() - { - // TODO unit test for the property 'Color' - } + /// /// Test the property 'Breed' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumArraysTests.cs index d6961ba49d04..f84821d33eb7 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumArraysTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumArrays"); } + /// /// Test the property 'JustSymbol' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumClassTests.cs index 062799d7cd7c..b37648d2200a 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumClassTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -77,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumTestTests.cs index 6a1bb8620a23..66664cbd9af1 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/EnumTestTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumTest"); } + /// /// Test the property 'EnumString' /// @@ -100,6 +90,14 @@ namespace IO.Swagger.Test { // TODO unit test for the property 'EnumNumber' } + /// + /// Test the property 'OuterEnum' + /// + [Test] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/FormatTestTests.cs index 9c4a16bea2e6..3ae16b2fc6b8 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/FormatTestTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a FormatTest"); } + /// /// Test the property 'Integer' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs index 9d915a7ca86f..cafd23d90b21 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/HasOnlyReadOnlyTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a HasOnlyReadOnly"); } + /// /// Test the property 'Bar' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ListTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ListTests.cs index 52037b2af000..6ca026a83e0f 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ListTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ListTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a List"); } + /// /// Test the property '_123List' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MapTestTests.cs index f19089b6e031..d61693c33228 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MapTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MapTestTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a MapTest"); } + /// /// Test the property 'MapMapOfString' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs index 2c9be9819070..55302d27c407 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a MixedPropertiesAndAdditionalPropertiesClass"); } + /// /// Test the property 'Uuid' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/Model200ResponseTests.cs index 111603f66a6c..cdb0c1960c28 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/Model200ResponseTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/Model200ResponseTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Model200Response"); } + /// /// Test the property 'Name' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelClientTests.cs index e1133467afce..f552ab929590 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelClientTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelClientTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelClient"); } + /// /// Test the property '_Client' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelReturnTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelReturnTests.cs index 212652805257..7c9ca513a7db 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelReturnTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ModelReturnTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelReturn"); } + /// /// Test the property '_Return' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NameTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NameTests.cs index 5e2cf85fc577..3802292269ac 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NameTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Name"); } + /// /// Test the property '_Name' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NumberOnlyTests.cs index c7dd8269f69b..afa72bf45e41 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NumberOnlyTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/NumberOnlyTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a NumberOnly"); } + /// /// Test the property 'JustNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OrderTests.cs index d0e673a2142d..40757e5c01ca 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OrderTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Order"); } + /// /// Test the property 'Id' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs index a24e20009cce..81a6cdf53235 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs index 3d2ab500d1a3..8cae88a554ad 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -64,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterComposite"); } + /// /// Test the property 'MyNumber' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterEnumTests.cs index e6bd10d185f9..b65bc240b0d3 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterEnumTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterEnumTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs index 66a97a03e7ba..55ebb7da9fda 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs index f6397957ece3..76a2c2253dc7 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs @@ -19,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -65,6 +66,7 @@ namespace IO.Swagger.Test } + } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/PetTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/PetTests.cs index fc8fba31bb97..89b221bde942 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/PetTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Pet"); } + /// /// Test the property 'Id' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs index 2d9da238b037..f3836f4cabda 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a ReadOnlyFirst"); } + /// /// Test the property 'Bar' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs index 9cac56054d06..547c62fd4820 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a SpecialModelName"); } + /// /// Test the property 'SpecialPropertyName' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/TagTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/TagTests.cs index eafbd6d80a24..adb4bf7c8be0 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/TagTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/TagTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a Tag"); } + /// /// Test the property 'Id' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/UserTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/UserTests.cs index 281273c60c23..1f64a7aa433a 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/UserTests.cs @@ -6,18 +6,6 @@ * 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. */ @@ -31,6 +19,7 @@ using IO.Swagger.Api; using IO.Swagger.Model; using IO.Swagger.Client; using System.Reflection; +using Newtonsoft.Json; namespace IO.Swagger.Test { @@ -76,6 +65,7 @@ namespace IO.Swagger.Test //Assert.IsInstanceOfType (instance, "variable 'instance' is a User"); } + /// /// Test the property 'Id' /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/packages.config b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/packages.config index 105b8298a455..a5a85c7294c6 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/packages.config +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/packages.config @@ -3,4 +3,5 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs deleted file mode 100644 index d33366a6fc7f..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ /dev/null @@ -1,331 +0,0 @@ -/* - * 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 - */ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace IO.Swagger.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFake_classname_tags123Api : IApiAccessor - { - #region Synchronous Operations - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// ModelClient - ModelClient TestClassname (ModelClient body); - - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// ApiResponse of ModelClient - ApiResponse TestClassnameWithHttpInfo (ModelClient body); - #endregion Synchronous Operations - #region Asynchronous Operations - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// Task of ModelClient - System.Threading.Tasks.Task TestClassnameAsync (ModelClient body); - - /// - /// To test class name in snake case - /// - /// - /// - /// - /// Thrown when fails to make API call - /// client model - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class Fake_classname_tags123Api : IFake_classname_tags123Api - { - private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public Fake_classname_tags123Api(String basePath) - { - this.Configuration = new Configuration { BasePath = basePath }; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public Fake_classname_tags123Api(Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Sets the base path of the API client. - /// - /// The base path - [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] - public void SetBasePath(String basePath) - { - // do nothing - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Configuration Configuration {get; set;} - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public IO.Swagger.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Gets the default header. - /// - /// Dictionary of HTTP header - [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public IDictionary DefaultHeader() - { - return new ReadOnlyDictionary(this.Configuration.DefaultHeader); - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] - public void AddDefaultHeader(string key, string value) - { - this.Configuration.AddDefaultHeader(key, value); - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// ModelClient - public ModelClient TestClassname (ModelClient body) - { - ApiResponse localVarResponse = TestClassnameWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); - - var localVarPath = "/fake_classname_test"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (api_key_query) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestClassname", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClassnameAsync (ModelClient body) - { - ApiResponse localVarResponse = await TestClassnameAsyncWithHttpInfo(body); - return localVarResponse.Data; - - } - - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); - - var localVarPath = "/fake_classname_test"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (api_key_query) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestClassname", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/JsonSubTypes.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/JsonSubTypes.cs deleted file mode 100644 index 3a6da091b781..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/JsonSubTypes.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace JsonSubTypes -{ - // Copied from project https://github.com/manuc66/JsonSubTypes - // https://raw.githubusercontent.com/manuc66/JsonSubTypes/07403192ea3f4959f6d42f5966ac56ceb0d6095b/JsonSubTypes/JsonSubtypes.cs - - public class JsonSubtypes : JsonConverter - { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeAttribute : Attribute - { - public Type SubType { get; private set; } - public object AssociatedValue { get; private set; } - - public KnownSubTypeAttribute(Type subType, object associatedValue) - { - SubType = subType; - AssociatedValue = associatedValue; - } - } - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] - public class KnownSubTypeWithPropertyAttribute : Attribute - { - public Type SubType { get; private set; } - public string PropertyName { get; private set; } - - public KnownSubTypeWithPropertyAttribute(Type subType, string propertyName) - { - SubType = subType; - PropertyName = propertyName; - } - } - - private readonly string _typeMappingPropertyName; - - private bool _isInsideRead; - private JsonReader _reader; - - public override bool CanRead - { - get - { - if (!_isInsideRead) - return true; - - return !string.IsNullOrEmpty(_reader.Path); - } - } - - public sealed override bool CanWrite - { - get { return false; } - } - - public JsonSubtypes() - { - } - - public JsonSubtypes(string typeMappingPropertyName) - { - _typeMappingPropertyName = typeMappingPropertyName; - } - - public override bool CanConvert(Type objectType) - { - return _typeMappingPropertyName != null; - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Comment) - reader.Read(); - - switch (reader.TokenType) - { - case JsonToken.Null: - return null; - case JsonToken.StartArray: - return ReadArray(reader, objectType, serializer); - case JsonToken.StartObject: - return ReadObject(reader, objectType, serializer); - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - - private IList ReadArray(JsonReader reader, Type targetType, JsonSerializer serializer) - { - var elementType = GetElementType(targetType); - - var list = CreateCompatibleList(targetType, elementType); - - while (reader.TokenType != JsonToken.EndArray && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.Null: - list.Add(reader.Value); - break; - case JsonToken.Comment: - break; - case JsonToken.StartObject: - list.Add(ReadObject(reader, elementType, serializer)); - break; - case JsonToken.EndArray: - break; - default: - throw new Exception("Array: Unrecognized token: " + reader.TokenType); - } - } - if (targetType.IsArray) - { - var array = Array.CreateInstance(targetType.GetElementType(), list.Count); - list.CopyTo(array, 0); - list = array; - } - return list; - } - - private static IList CreateCompatibleList(Type targetContainerType, Type elementType) - { - IList list; - if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract) - { - list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); - } - else - { - list = (IList)Activator.CreateInstance(targetContainerType); - } - return list; - } - - private static Type GetElementType(Type arrayOrGenericContainer) - { - Type elementType; - if (arrayOrGenericContainer.IsArray) - { - elementType = arrayOrGenericContainer.GetElementType(); - } - else - { - elementType = arrayOrGenericContainer.GenericTypeArguments[0]; - } - return elementType; - } - - private object ReadObject(JsonReader reader, Type objectType, JsonSerializer serializer) - { - var jObject = JObject.Load(reader); - - var targetType = GetType(jObject, objectType) ?? objectType; - - return _ReadJson(CreateAnotherReader(jObject, reader), targetType, null, serializer); - } - - private static JsonReader CreateAnotherReader(JObject jObject, JsonReader reader) - { - var jObjectReader = jObject.CreateReader(); - jObjectReader.Culture = reader.Culture; - jObjectReader.CloseInput = reader.CloseInput; - jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; - jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; - jObjectReader.FloatParseHandling = reader.FloatParseHandling; - jObjectReader.DateFormatString = reader.DateFormatString; - jObjectReader.DateParseHandling = reader.DateParseHandling; - return jObjectReader; - } - - public Type GetType(JObject jObject, Type parentType) - { - if (_typeMappingPropertyName == null) - { - return GetTypeByPropertyPresence(jObject, parentType); - } - return GetTypeFromDiscriminatorValue(jObject, parentType); - } - - private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType) - { - foreach (var type in parentType.GetTypeInfo().GetCustomAttributes()) - { - JToken ignore; - if (jObject.TryGetValue(type.PropertyName, out ignore)) - { - return type.SubType; - } - } - return null; - } - - private Type GetTypeFromDiscriminatorValue(JObject jObject, Type parentType) - { - JToken jToken; - if (!jObject.TryGetValue(_typeMappingPropertyName, out jToken)) return null; - - var discriminatorValue = jToken.ToObject(); - if (discriminatorValue == null) return null; - - var typeMapping = GetSubTypeMapping(parentType); - if (typeMapping.Any()) - { - return GetTypeFromMapping(typeMapping, discriminatorValue); - } - return GetTypeByName(discriminatorValue as string, parentType); - } - - private static Type GetTypeByName(string typeName, Type parentType) - { - if (typeName == null) - return null; - - var insideAssembly = parentType.GetTypeInfo().Assembly; - - var typeByName = insideAssembly.GetType(typeName); - if (typeByName == null) - { - var searchLocation = parentType.FullName.Substring(0, parentType.FullName.Length - parentType.Name.Length); - typeByName = insideAssembly.GetType(searchLocation + typeName, false, true); - } - return typeByName; - } - - private static Type GetTypeFromMapping(IReadOnlyDictionary typeMapping, object discriminatorValue) - { - var targetlookupValueType = typeMapping.First().Key.GetType(); - var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType); - - Type targetType; - return typeMapping.TryGetValue(lookupValue, out targetType) ? targetType : null; - } - - private static Dictionary GetSubTypeMapping(Type type) - { - return type.GetTypeInfo().GetCustomAttributes().ToDictionary(x => x.AssociatedValue, x => x.SubType); - } - - private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType) - { - if (targetlookupValueType.GetTypeInfo().IsEnum) - return Enum.ToObject(targetlookupValueType, objectType); - - return Convert.ChangeType(objectType, targetlookupValueType); - } - - protected object _ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - _reader = reader; - _isInsideRead = true; - try - { - return serializer.Deserialize(reader, objectType); - } - finally - { - _isInsideRead = false; - } - } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj index 1cc828f49395..7699bb4cef88 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj @@ -53,6 +53,12 @@ Contact: apiteam@swagger.io ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + $(SolutionDir)\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.1.3\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs index 2776b6ed2fed..7bc7fe23ac1d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs @@ -44,16 +44,20 @@ namespace IO.Swagger.Model /// Enum GreaterThanOrEqualTo for ">=" /// [EnumMember(Value = ">=")] - GreaterThanOrEqualTo, + GreaterThanOrEqualTo = 1, /// /// Enum Dollar for "$" /// [EnumMember(Value = "$")] - Dollar + Dollar = 2 } - + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// @@ -65,20 +69,16 @@ namespace IO.Swagger.Model /// Enum Fish for "fish" /// [EnumMember(Value = "fish")] - Fish, + Fish = 1, /// /// Enum Crab for "crab" /// [EnumMember(Value = "crab")] - Crab + Crab = 2 } - /// - /// Gets or Sets JustSymbol - /// - [DataMember(Name="just_symbol", EmitDefaultValue=false)] - public JustSymbolEnum? JustSymbol { get; set; } + /// /// Gets or Sets ArrayEnum /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumClass.cs index a114e12a7af9..4a0b406bddf4 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumClass.cs @@ -37,19 +37,19 @@ namespace IO.Swagger.Model /// Enum Abc for "_abc" /// [EnumMember(Value = "_abc")] - Abc, + Abc = 1, /// /// Enum Efg for "-efg" /// [EnumMember(Value = "-efg")] - Efg, + Efg = 2, /// /// Enum Xyz for "(xyz)" /// [EnumMember(Value = "(xyz)")] - Xyz + Xyz = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs index e909c51c31e7..dd78f660aae0 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs @@ -44,21 +44,26 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower, + Lower = 2, /// /// Enum Empty for "" /// [EnumMember(Value = "")] - Empty + Empty = 3 } + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } /// /// Gets or Sets EnumInteger /// @@ -79,6 +84,11 @@ namespace IO.Swagger.Model NUMBER_MINUS_1 = -1 } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// @@ -90,38 +100,33 @@ namespace IO.Swagger.Model /// Enum NUMBER_1_DOT_1 for 1.1 /// [EnumMember(Value = "1.1")] - NUMBER_1_DOT_1, + NUMBER_1_DOT_1 = 1, /// /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 /// [EnumMember(Value = "-1.2")] - NUMBER_MINUS_1_DOT_2 + NUMBER_MINUS_1_DOT_2 = 2 } - /// - /// Gets or Sets EnumString - /// - [DataMember(Name="enum_string", EmitDefaultValue=false)] - public EnumStringEnum? EnumString { get; set; } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public EnumIntegerEnum? EnumInteger { get; set; } /// /// Gets or Sets EnumNumber /// [DataMember(Name="enum_number", EmitDefaultValue=false)] public EnumNumberEnum? EnumNumber { get; set; } /// + /// Gets or Sets OuterEnum + /// + [DataMember(Name="outerEnum", EmitDefaultValue=false)] + public OuterEnum? OuterEnum { get; set; } + /// /// Initializes a new instance of the class. /// /// EnumString. /// EnumInteger. /// EnumNumber. /// OuterEnum. - public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum OuterEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum? OuterEnum = default(OuterEnum?)) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -132,11 +137,6 @@ namespace IO.Swagger.Model - /// - /// Gets or Sets OuterEnum - /// - [DataMember(Name="outerEnum", EmitDefaultValue=false)] - public OuterEnum OuterEnum { get; set; } /// /// Returns the string presentation of the object diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs index 126eed194a11..e0a0e97a99fc 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs @@ -33,7 +33,6 @@ namespace IO.Swagger.Model [ImplementPropertyChanged] public partial class MapTest : IEquatable, IValidatableObject { - /// /// Gets or Sets Inner /// @@ -45,15 +44,16 @@ namespace IO.Swagger.Model /// Enum UPPER for "UPPER" /// [EnumMember(Value = "UPPER")] - UPPER, + UPPER = 1, /// /// Enum Lower for "lower" /// [EnumMember(Value = "lower")] - Lower + Lower = 2 } + /// /// Gets or Sets MapOfEnumString /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs index a3dc7eea2e7f..d256ac2fd954 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs @@ -45,19 +45,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterEnum.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterEnum.cs index ca7c03601eee..9d77254cf878 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterEnum.cs @@ -37,19 +37,19 @@ namespace IO.Swagger.Model /// Enum Placed for "placed" /// [EnumMember(Value = "placed")] - Placed, + Placed = 1, /// /// Enum Approved for "approved" /// [EnumMember(Value = "approved")] - Approved, + Approved = 2, /// /// Enum Delivered for "delivered" /// [EnumMember(Value = "delivered")] - Delivered + Delivered = 3 } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs index d57e936bb2db..496ec662ba9b 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs @@ -45,19 +45,19 @@ namespace IO.Swagger.Model /// Enum Available for "available" /// [EnumMember(Value = "available")] - Available, + Available = 1, /// /// Enum Pending for "pending" /// [EnumMember(Value = "pending")] - Pending, + Pending = 2, /// /// Enum Sold for "sold" /// [EnumMember(Value = "sold")] - Sold + Sold = 3 } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/packages.config b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/packages.config index 2ce1bb2f3cd7..328794c68bc2 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/packages.config +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/packages.config @@ -2,6 +2,7 @@ +