From 329530c4425e46119b2b6f059c8e317133a07752 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 4 Mar 2016 14:46:01 +0800 Subject: [PATCH] better model name for c# --- .../src/main/csharp/IO/Swagger/Api/PetApi.cs | 52 ++++---- .../main/csharp/IO/Swagger/Api/StoreApi.cs | 26 ++-- .../IO/Swagger/Model/InlineResponse200.cs | 18 ++- .../csharp/IO/Swagger/Model/ObjectReturn.cs | 113 ++++++++++++++++++ .../IO/Swagger/Model/SpecialModelName.cs | 113 ++++++++++++++++++ .../SwaggerClientTest.csproj | 2 + .../SwaggerClientTest.userprefs | 23 +--- 7 files changed, 278 insertions(+), 69 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs index c1bb30d00c33..8471bd2141b4 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs @@ -1352,6 +1352,12 @@ namespace IO.Swagger.Api + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } // authentication (petstore_auth) required // oauth required @@ -1359,12 +1365,6 @@ namespace IO.Swagger.Api { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } - // authentication (api_key) required - - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } // make the HTTP request @@ -1445,6 +1445,13 @@ namespace IO.Swagger.Api + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } + // authentication (petstore_auth) required // oauth required @@ -1453,13 +1460,6 @@ namespace IO.Swagger.Api localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } - // authentication (api_key) required - - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -2267,6 +2267,12 @@ namespace IO.Swagger.Api + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } // authentication (petstore_auth) required // oauth required @@ -2274,12 +2280,6 @@ namespace IO.Swagger.Api { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } - // authentication (api_key) required - - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } // make the HTTP request @@ -2360,6 +2360,13 @@ namespace IO.Swagger.Api + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } + // authentication (petstore_auth) required // oauth required @@ -2368,13 +2375,6 @@ namespace IO.Swagger.Api localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } - // authentication (api_key) required - - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs index 868dfdae4087..4000f9b754c4 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs @@ -1102,18 +1102,18 @@ namespace IO.Swagger.Api - // authentication (test_api_key_query) required - - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_query"))) - { - localVarQueryParams["test_api_key_query"] = Configuration.GetApiKeyWithPrefix("test_api_key_query"); - } // authentication (test_api_key_header) required if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_header"))) { localVarHeaderParams["test_api_key_header"] = Configuration.GetApiKeyWithPrefix("test_api_key_header"); } + // authentication (test_api_key_query) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_query"))) + { + localVarQueryParams["test_api_key_query"] = Configuration.GetApiKeyWithPrefix("test_api_key_query"); + } // make the HTTP request @@ -1194,13 +1194,6 @@ namespace IO.Swagger.Api - // authentication (test_api_key_query) required - - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_query"))) - { - localVarQueryParams["test_api_key_query"] = Configuration.GetApiKeyWithPrefix("test_api_key_query"); - } - // authentication (test_api_key_header) required if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_header"))) @@ -1208,6 +1201,13 @@ namespace IO.Swagger.Api localVarHeaderParams["test_api_key_header"] = Configuration.GetApiKeyWithPrefix("test_api_key_header"); } + // authentication (test_api_key_query) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_query"))) + { + localVarQueryParams["test_api_key_query"] = Configuration.GetApiKeyWithPrefix("test_api_key_query"); + } + // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs index 0d5c695c5a0d..d575b7e46a81 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs @@ -7,17 +7,19 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { - /// /// /// [DataContract] public partial class InlineResponse200 : IEquatable - { + { + /// + /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// /// Id (required). @@ -39,30 +41,26 @@ namespace IO.Swagger.Model this.Name = Name; } - + /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] public long? Id { get; set; } - - + /// /// Gets or Sets Category /// [DataMember(Name="category", EmitDefaultValue=false)] public Object Category { get; set; } - - + /// /// Gets or Sets Name /// [DataMember(Name="name", EmitDefaultValue=false)] public string Name { get; set; } - - - + /// /// Returns the string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs new file mode 100644 index 000000000000..1ea3dea45c50 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs @@ -0,0 +1,113 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class ObjectReturn : IEquatable + { + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// _Return. + + public ObjectReturn(int? _Return = null) + { + this._Return = _Return; + + } + + + /// + /// Gets or Sets _Return + /// + [DataMember(Name="return", EmitDefaultValue=false)] + public int? _Return { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ObjectReturn {\n"); + sb.Append(" _Return: ").Append(_Return).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as ObjectReturn); + } + + /// + /// Returns true if ObjectReturn instances are equal + /// + /// Instance of ObjectReturn to be compared + /// Boolean + public bool Equals(ObjectReturn other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this._Return == other._Return || + this._Return != null && + this._Return.Equals(other._Return) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this._Return != null) + hash = hash * 59 + this._Return.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs new file mode 100644 index 000000000000..4424503f008d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs @@ -0,0 +1,113 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class SpecialModelName : IEquatable + { + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// SpecialPropertyName. + + public SpecialModelName(long? SpecialPropertyName = null) + { + this.SpecialPropertyName = SpecialPropertyName; + + } + + + /// + /// Gets or Sets SpecialPropertyName + /// + [DataMember(Name="$special[property.name]", EmitDefaultValue=false)] + public long? SpecialPropertyName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SpecialModelName {\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as SpecialModelName); + } + + /// + /// Returns true if SpecialModelName instances are equal + /// + /// Instance of SpecialModelName to be compared + /// Boolean + public bool Equals(SpecialModelName other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.SpecialPropertyName == other.SpecialPropertyName || + this.SpecialPropertyName != null && + this.SpecialPropertyName.Equals(other.SpecialPropertyName) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.SpecialPropertyName != null) + hash = hash * 59 + this.SpecialPropertyName.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index bb10c94d339b..fad04017f7a8 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -60,6 +60,8 @@ + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index fc69023c5ff1..2e3f974728e4 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,28 +1,11 @@ - + - + - + - - - - - - - - - - - - - - - - -