From fab28b018792f22cc8996d48c96d0b70442f8cf4 Mon Sep 17 00:00:00 2001 From: Jan Geske Date: Thu, 3 May 2018 12:02:51 +0200 Subject: [PATCH] [csharp] masked EnumMember names in modelEnum added quotations for EnumMember names in modelEnum template --- .../main/resources/csharp/enumClass.mustache | 2 +- .../SwaggerClient/.swagger-codegen/VERSION | 2 +- .../csharp/SwaggerClient/README.md | 2 +- .../src/IO.Swagger/Model/Return.cs | 6 +- .../petstore/csharp/SwaggerClient/README.md | 1 + .../csharp/SwaggerClient/docs/EnumTest.md | 1 + .../csharp/SwaggerClient/docs/FakeApi.md | 60 ++++++ .../docs/FakeClassnameTags123Api.md | 2 + .../csharp/SwaggerClient/docs/UserApi.md | 4 +- .../src/IO.Swagger/Api/FakeApi.cs | 203 ++++++++++++++++++ .../IO.Swagger/Api/FakeClassnameTags123Api.cs | 16 +- .../src/IO.Swagger/Api/UserApi.cs | 16 +- .../src/IO.Swagger/Model/EnumTest.cs | 57 ++++- 13 files changed, 347 insertions(+), 25 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index 015e7142dbc..f97bf82d888 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -11,7 +11,7 @@ /// /// Enum {{name}} for {{{value}}} /// - [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] + [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{#isString}}"{{/isString}}{{{value}}}{{#isString}}"{{/isString}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} } diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/.swagger-codegen/VERSION b/samples/client/petstore-security-test/csharp/SwaggerClient/.swagger-codegen/VERSION index 50794f17f1a..855ff9501eb 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/.swagger-codegen/VERSION +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/README.md b/samples/client/petstore-security-test/csharp/SwaggerClient/README.md index 4bc77a18568..cd7f6b810d1 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/README.md +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/README.md @@ -19,7 +19,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later - [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later -The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` Install-Package RestSharp Install-Package Newtonsoft.Json diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/Return.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/Return.cs index 7867fe5cda5..2730e73f9d5 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/Return.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/Return.cs @@ -33,10 +33,10 @@ public partial class Return : IEquatable, IValidatableObject /// /// Initializes a new instance of the class. /// - /// property description *_/ ' \" =end - - \\r\\n \\n \\r. - public Return(int? _Return = default(int?)) + /// property description *_/ ' \" =end - - \\r\\n \\n \\r. + public Return(int? _return = default(int?)) { - this._Return = _Return; + this._Return = _return; } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 7cd60c36767..5a856ccd012 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -101,6 +101,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *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 diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md index 5b38bb5b3a5..f3278be4cf3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | **EnumInteger** | **int?** | | [optional] **EnumNumber** | **double?** | | [optional] **OuterEnum** | **OuterEnum** | | [optional] diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index 8858b6bf7c4..d5929dcd9c3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**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 @@ -255,6 +256,65 @@ 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) + +# **TestBodyWithQueryParams** +> void TestBodyWithQueryParams (User body, string query) + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestBodyWithQueryParamsExample + { + public void main() + { + var apiInstance = new FakeApi(); + var body = new User(); // User | + var query = query_example; // string | + + try + { + apiInstance.TestBodyWithQueryParams(body, query); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **string**| | + +### 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) + # **TestClientModel** > ModelClient TestClientModel (ModelClient body) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeClassnameTags123Api.md index 5f1d0ca776b..0c972a86431 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeClassnameTags123Api.md @@ -13,6 +13,8 @@ Method | HTTP request | Description To test class name in snake case +To test class name in snake case + ### Example ```csharp using System; diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/UserApi.md index fd9bfb0e973..dfe89c60ab9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/UserApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/UserApi.md @@ -271,7 +271,7 @@ namespace Example public void main() { var apiInstance = new UserApi(); - var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. + var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. try { @@ -292,7 +292,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | ### Return type diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index d281bbd031c..76693525084 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -109,6 +109,29 @@ public interface IFakeApi : IApiAccessor /// ApiResponse of OuterString ApiResponse FakeOuterStringSerializeWithHttpInfo (OuterString body = null); /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + void TestBodyWithQueryParams (User body, string query); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithQueryParamsWithHttpInfo (User body, string query); + /// /// To test \"client\" model /// /// @@ -342,6 +365,29 @@ public interface IFakeApi : IApiAccessor /// Task of ApiResponse (OuterString) System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null); /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + System.Threading.Tasks.Task TestBodyWithQueryParamsAsync (User body, string query); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithQueryParamsAsyncWithHttpInfo (User body, string query); + /// /// To test \"client\" model /// /// @@ -1144,6 +1190,163 @@ public async System.Threading.Tasks.Task> FakeOuterStri (OuterString) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); } + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + public void TestBodyWithQueryParams (User body, string query) + { + TestBodyWithQueryParamsWithHttpInfo(body, query); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithQueryParamsWithHttpInfo (User body, string query) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithQueryParams"); + // verify the required parameter 'query' is set + if (query == null) + throw new ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + + var localVarPath = "/fake/body-with-query-params"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.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 = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithQueryParams", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync (User body, string query) + { + await TestBodyWithQueryParamsAsyncWithHttpInfo(body, query); + + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithQueryParamsAsyncWithHttpInfo (User body, string query) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithQueryParams"); + // verify the required parameter 'query' is set + if (query == null) + throw new ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + + var localVarPath = "/fake/body-with-query-params"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.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 = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithQueryParams", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// To test \"client\" model To test \"client\" model /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeClassnameTags123Api.cs index 3a67445d192..930a71d1434 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeClassnameTags123Api.cs @@ -28,7 +28,7 @@ public interface IFakeClassnameTags123Api : IApiAccessor /// To test class name in snake case /// /// - /// + /// To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -39,7 +39,7 @@ public interface IFakeClassnameTags123Api : IApiAccessor /// To test class name in snake case /// /// - /// + /// To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -51,7 +51,7 @@ public interface IFakeClassnameTags123Api : IApiAccessor /// To test class name in snake case /// /// - /// + /// To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -62,7 +62,7 @@ public interface IFakeClassnameTags123Api : IApiAccessor /// To test class name in snake case /// /// - /// + /// To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -169,7 +169,7 @@ public void AddDefaultHeader(string key, string value) } /// - /// To test class name in snake case + /// To test class name in snake case To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -181,7 +181,7 @@ public ModelClient TestClassname (ModelClient body) } /// - /// To test class name in snake case + /// To test class name in snake case To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -248,7 +248,7 @@ public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) } /// - /// To test class name in snake case + /// To test class name in snake case To test class name in snake case /// /// Thrown when fails to make API call /// client model @@ -261,7 +261,7 @@ public async System.Threading.Tasks.Task TestClassnameAsync (ModelC } /// - /// To test class name in snake case + /// To test class name in snake case To test class name in snake case /// /// Thrown when fails to make API call /// client model diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs index 3a6e0fe465f..094d085a355 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs @@ -115,7 +115,7 @@ public interface IUserApi : IApiAccessor /// /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// User User GetUserByName (string username); @@ -126,7 +126,7 @@ public interface IUserApi : IApiAccessor /// /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// ApiResponse of User ApiResponse GetUserByNameWithHttpInfo (string username); /// @@ -287,7 +287,7 @@ public interface IUserApi : IApiAccessor /// /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// Task of User System.Threading.Tasks.Task GetUserByNameAsync (string username); @@ -298,7 +298,7 @@ public interface IUserApi : IApiAccessor /// /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// Task of ApiResponse (User) System.Threading.Tasks.Task> GetUserByNameAsyncWithHttpInfo (string username); /// @@ -1044,7 +1044,7 @@ public async System.Threading.Tasks.Task> DeleteUserAsyncWit /// Get user by user name /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// User public User GetUserByName (string username) { @@ -1056,7 +1056,7 @@ public User GetUserByName (string username) /// Get user by user name /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// ApiResponse of User public ApiResponse< User > GetUserByNameWithHttpInfo (string username) { @@ -1111,7 +1111,7 @@ public ApiResponse< User > GetUserByNameWithHttpInfo (string username) /// Get user by user name /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// Task of User public async System.Threading.Tasks.Task GetUserByNameAsync (string username) { @@ -1124,7 +1124,7 @@ public async System.Threading.Tasks.Task GetUserByNameAsync (string userna /// Get user by user name /// /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// Task of ApiResponse (User) public async System.Threading.Tasks.Task> GetUserByNameAsyncWithHttpInfo (string username) { 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 5f4b84d5b7e..0e0041b49e0 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 @@ -62,6 +62,37 @@ public enum EnumStringEnum [DataMember(Name="enum_string", EmitDefaultValue=false)] public EnumStringEnum? EnumString { get; set; } /// + /// Defines EnumStringRequired + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumStringRequiredEnum + { + + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3 + } + + /// + /// Gets or Sets EnumStringRequired + /// + [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// /// Defines EnumInteger /// public enum EnumIntegerEnum @@ -118,12 +149,27 @@ public enum EnumNumberEnum /// /// Initializes a new instance of the class. /// + [JsonConstructorAttribute] + protected EnumTest() { } + /// + /// Initializes a new instance of the class. + /// /// enumString. + /// enumStringRequired (required). /// 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?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { + // to ensure "enumStringRequired" is required (not null) + if (enumStringRequired == null) + { + throw new InvalidDataException("enumStringRequired is a required property for EnumTest and cannot be null"); + } + else + { + this.EnumStringRequired = enumStringRequired; + } this.EnumString = enumString; this.EnumInteger = enumInteger; this.EnumNumber = enumNumber; @@ -134,6 +180,7 @@ public enum EnumNumberEnum + /// /// Returns the string presentation of the object /// @@ -143,6 +190,7 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class EnumTest {\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); @@ -185,6 +233,11 @@ public bool Equals(EnumTest input) (this.EnumString != null && this.EnumString.Equals(input.EnumString)) ) && + ( + this.EnumStringRequired == input.EnumStringRequired || + (this.EnumStringRequired != null && + this.EnumStringRequired.Equals(input.EnumStringRequired)) + ) && ( this.EnumInteger == input.EnumInteger || (this.EnumInteger != null && @@ -213,6 +266,8 @@ public override int GetHashCode() int hashCode = 41; if (this.EnumString != null) hashCode = hashCode * 59 + this.EnumString.GetHashCode(); + if (this.EnumStringRequired != null) + hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode(); if (this.EnumInteger != null) hashCode = hashCode * 59 + this.EnumInteger.GetHashCode(); if (this.EnumNumber != null)