diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index cbf606f1c12..f03b53af4b0 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -223,58 +223,12 @@ public class DefaultCodegen { cm.allowableValues.put("enumVars", enumVars); } - // for enum model's properties + // update codegen property enum with proper naming convention + // and handling of numbers, special characters for (CodegenProperty var : cm.vars) { - Map allowableValues = var.allowableValues; - - // handle ArrayProperty - if (var.items != null) { - allowableValues = var.items.allowableValues; - } - - if (allowableValues == null) { - continue; - } - //List values = (List) allowableValues.get("values"); - List values = (List) allowableValues.get("values"); - if (values == null) { - continue; - } - - // put "enumVars" map into `allowableValues", including `name` and `value` - List> enumVars = new ArrayList>(); - String commonPrefix = findCommonPrefixOfVars(values); - int truncateIdx = commonPrefix.length(); - for (Object value : values) { - Map enumVar = new HashMap(); - String enumName; - if (truncateIdx == 0) { - enumName = value.toString(); - } else { - enumName = value.toString().substring(truncateIdx); - if ("".equals(enumName)) { - enumName = value.toString(); - } - } - enumVar.put("name", toEnumVarName(enumName, var.datatype)); - enumVar.put("value", toEnumValue(value.toString(), var.datatype)); - enumVars.add(enumVar); - } - allowableValues.put("enumVars", enumVars); - // handle default value for enum, e.g. available => StatusEnum.AVAILABLE - if (var.defaultValue != null) { - String enumName = null; - for (Map enumVar : enumVars) { - if (toEnumValue(var.defaultValue, var.datatype).equals(enumVar.get("value"))) { - enumName = enumVar.get("name"); - break; - } - } - if (enumName != null) { - var.defaultValue = toEnumDefaultValue(enumName, var.datatypeWithEnum); - } - } + updateCodegenPropertyEnum(var); } + } return objs; } @@ -1572,48 +1526,137 @@ public class DefaultCodegen { property.baseType = getSwaggerType(p); if (p instanceof ArrayProperty) { - property.isContainer = true; - property.isListContainer = true; - property.containerType = "array"; - ArrayProperty ap = (ArrayProperty) p; - CodegenProperty cp = fromProperty(property.name, ap.getItems()); - if (cp == null) { - LOGGER.warn("skipping invalid property " + Json.pretty(p)); - } else { - property.baseType = getSwaggerType(p); - if (!languageSpecificPrimitives.contains(cp.baseType)) { - property.complexType = cp.baseType; - } else { - property.isPrimitiveType = true; - } - property.items = cp; - if (property.items.isEnum) { - property.datatypeWithEnum = property.datatypeWithEnum.replace(property.items.baseType, - property.items.datatypeWithEnum); - if(property.defaultValue != null) - property.defaultValue = property.defaultValue.replace(property.items.baseType, property.items.datatypeWithEnum); - } - } + property.isContainer = true; + property.isListContainer = true; + property.containerType = "array"; + property.baseType = getSwaggerType(p); + // handle inner property + ArrayProperty ap = (ArrayProperty) p; + CodegenProperty cp = fromProperty(property.name, ap.getItems()); + updatePropertyForArray(property, cp); } else if (p instanceof MapProperty) { property.isContainer = true; property.isMapContainer = true; property.containerType = "map"; + property.baseType = getSwaggerType(p); + // handle inner property MapProperty ap = (MapProperty) p; CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties()); - property.items = cp; - - property.baseType = getSwaggerType(p); - if (!languageSpecificPrimitives.contains(cp.baseType)) { - property.complexType = cp.baseType; - } else { - property.isPrimitiveType = true; - } + updatePropertyForMap(property, cp); } else { setNonArrayMapProperty(property, type); } return property; } + /** + * Update property for array(list) container + * @param property Codegen property + * @param innerProperty Codegen inner property of map or list + */ + protected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty) { + if (innerProperty == null) { + LOGGER.warn("skipping invalid array property " + Json.pretty(property)); + } else { + if (!languageSpecificPrimitives.contains(innerProperty.baseType)) { + property.complexType = innerProperty.baseType; + } else { + property.isPrimitiveType = true; + } + property.items = innerProperty; + // inner item is Enum + if (isPropertyInnerMostEnum(property)) { + property.isEnum = true; + // update datatypeWithEnum for array + // e.g. List => List + updateDataTypeWithEnumForArray(property); + + // TOOD need to revise the default value for enum + if (property.defaultValue != null) { + property.defaultValue = property.defaultValue.replace(property.items.baseType, property.items.datatypeWithEnum); + } + } + } + } + + /** + * Update property for map container + * @param property Codegen property + * @param innerProperty Codegen inner property of map or list + */ + protected void updatePropertyForMap(CodegenProperty property, CodegenProperty innerProperty) { + if (innerProperty == null) { + LOGGER.warn("skipping invalid map property " + Json.pretty(property)); + return; + } else { + if (!languageSpecificPrimitives.contains(innerProperty.baseType)) { + property.complexType = innerProperty.baseType; + } else { + property.isPrimitiveType = true; + } + property.items = innerProperty; + // inner item is Enum + if (isPropertyInnerMostEnum(property)) { + property.isEnum = true; + // update datatypeWithEnum for map + // e.g. Dictionary => Dictionary + updateDataTypeWithEnumForMap(property); + + // TOOD need to revise the default value for enum + // set default value + if (property.defaultValue != null) { + property.defaultValue = property.defaultValue.replace(property.items.baseType, property.items.datatypeWithEnum); + } + } + } + + } + + /** + * Update property for map container + * @param property Codegen property + * @return True if the inner most type is enum + */ + protected Boolean isPropertyInnerMostEnum(CodegenProperty property) { + CodegenProperty currentProperty = property; + while (currentProperty != null && (Boolean.TRUE.equals(currentProperty.isMapContainer) + || Boolean.TRUE.equals(currentProperty.isListContainer))) { + currentProperty = currentProperty.items; + } + + return currentProperty.isEnum; + } + + /** + * Update datatypeWithEnum for array container + * @param property Codegen property + */ + protected void updateDataTypeWithEnumForArray(CodegenProperty property) { + CodegenProperty baseItem = property.items; + while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMapContainer) + || Boolean.TRUE.equals(baseItem.isListContainer))) { + baseItem = baseItem.items; + } + // set both datatype and datetypeWithEnum as only the inner type is enum + property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType, toEnumName(baseItem)); + //property.datatype = property.datatypeWithEnum; + } + + /** + * Update datatypeWithEnum for map container + * @param property Codegen property + */ + protected void updateDataTypeWithEnumForMap(CodegenProperty property) { + CodegenProperty baseItem = property.items; + while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMapContainer) + || Boolean.TRUE.equals(baseItem.isListContainer))) { + baseItem = baseItem.items; + } + // set both datatype and datetypeWithEnum as only the inner type is enum + property.datatypeWithEnum = property.datatypeWithEnum.replace(", " + baseItem.baseType, ", " + toEnumName(baseItem)); + //property.datatype = property.datatypeWithEnum; + } + protected void setNonArrayMapProperty(CodegenProperty property, String type) { property.isNotContainer = true; if (languageSpecificPrimitives().contains(type)) { @@ -2064,22 +2107,28 @@ public class DefaultCodegen { LOGGER.warn("warning! Property type \"" + type + "\" not found for parameter \"" + param.getName() + "\", using String"); property = new StringProperty().description("//TODO automatically added by swagger-codegen. Type was " + type + " but not supported"); } + property.setRequired(param.getRequired()); - CodegenProperty model = fromProperty(qp.getName(), property); + CodegenProperty cp = fromProperty(qp.getName(), property); // set boolean flag (e.g. isString) - setParameterBooleanFlagWithCodegenProperty(p, model); + setParameterBooleanFlagWithCodegenProperty(p, cp); - p.dataType = model.datatype; - if(model.isEnum) { - p.datatypeWithEnum = model.datatypeWithEnum; + p.dataType = cp.datatype; + if(cp.isEnum) { + p.datatypeWithEnum = cp.datatypeWithEnum; } - p.isEnum = model.isEnum; - p._enum = model._enum; - p.allowableValues = model.allowableValues; - if(model.items != null && model.items.isEnum) { - p.datatypeWithEnum = model.datatypeWithEnum; - p.items = model.items; + + // enum + updateCodegenPropertyEnum(cp); + p.isEnum = cp.isEnum; + p._enum = cp._enum; + p.allowableValues = cp.allowableValues; + + + if (cp.items != null && cp.items.isEnum) { + p.datatypeWithEnum = cp.datatypeWithEnum; + p.items = cp.items; } p.collectionFormat = collectionFormat; if(collectionFormat != null && collectionFormat.equals("multi")) { @@ -2087,10 +2136,12 @@ public class DefaultCodegen { } p.paramName = toParamName(qp.getName()); - if (model.complexType != null) { - imports.add(model.complexType); + // import + if (cp.complexType != null) { + imports.add(cp.complexType); } + // validation p.maximum = qp.getMaximum(); p.exclusiveMaximum = qp.isExclusiveMaximum(); p.minimum = qp.getMinimum(); @@ -3026,4 +3077,63 @@ public class DefaultCodegen { LOGGER.debug("Property type is not primitive: " + property.datatype); } } + + + /** + * update codegen property's enum by adding "enumVars" (which has name and value) + * + * @param cpList list of CodegenProperty + */ + public void updateCodegenPropertyEnum(CodegenProperty var) { + Map allowableValues = var.allowableValues; + + // handle ArrayProperty + if (var.items != null) { + allowableValues = var.items.allowableValues; + } + + if (allowableValues == null) { + return; + } + + //List values = (List) allowableValues.get("values"); + List values = (List) allowableValues.get("values"); + if (values == null) { + return; + } + + // put "enumVars" map into `allowableValues", including `name` and `value` + List> enumVars = new ArrayList>(); + String commonPrefix = findCommonPrefixOfVars(values); + int truncateIdx = commonPrefix.length(); + for (Object value : values) { + Map enumVar = new HashMap(); + String enumName; + if (truncateIdx == 0) { + enumName = value.toString(); + } else { + enumName = value.toString().substring(truncateIdx); + if ("".equals(enumName)) { + enumName = value.toString(); + } + } + enumVar.put("name", toEnumVarName(enumName, var.datatype)); + enumVar.put("value", toEnumValue(value.toString(), var.datatype)); + enumVars.add(enumVar); + } + allowableValues.put("enumVars", enumVars); + // handle default value for enum, e.g. available => StatusEnum.AVAILABLE + if (var.defaultValue != null) { + String enumName = null; + for (Map enumVar : enumVars) { + if (toEnumValue(var.defaultValue, var.datatype).equals(enumVar.get("value"))) { + enumName = enumVar.get("name"); + break; + } + } + if (enumName != null) { + var.defaultValue = toEnumDefaultValue(enumName, var.datatypeWithEnum); + } + } + } } diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index c8f0511673a..aaf6df8cf2e 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -21,7 +21,7 @@ /// {{#description}} /// {{{description}}}{{/description}} [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] - public {{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} { get; set; } + public {{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}?{{/isContainer}}{{/isEnum}} {{name}} { get; set; } {{/isEnum}} {{/vars}} {{#hasRequired}} @@ -44,7 +44,7 @@ {{#hasOnlyReadOnly}} [JsonConstructorAttribute] {{/hasOnlyReadOnly}} - public {{classname}}({{#readWriteVars}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{^-last}}, {{/-last}}{{/readWriteVars}}) + public {{classname}}({{#readWriteVars}}{{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}?{{/isContainer}}{{/isEnum}} {{name}} = null{{^-last}}, {{/-last}}{{/readWriteVars}}) { {{#vars}} {{^isReadOnly}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache index 5249d754577..855a710c7ed 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache @@ -1,9 +1,10 @@ + {{^isContainer}} /// /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} /// {{#description}} /// {{{description}}}{{/description}} [JsonConverter(typeof(StringEnumConverter))] - public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + public enum {{#datatypeWithEnum}}{{&.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} /// @@ -13,3 +14,4 @@ {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} } + {{/isContainer}} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 069c2913ae8..2f840d9622e 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -561,6 +561,47 @@ paths: description: User not found /fake: + get: + tags: + - fake + summary: To test enum query parameters + descriptions: To test enum query parameters + operationId: testEnumQueryParameters + consumes: + - application/json + produces: + - application/json + parameters: + - name: enum_query_string + type: string + default: '-efg' + enum: + - _abc + - '-efg' + - (xyz) + in: formData + description: Query parameter enum test (string) + - name: enum_query_integer + type: number + format: int32 + enum: + - 1 + - -2 + in: query + description: Query parameter enum test (double) + - name: enum_query_double + type: number + format: double + enum: + - 1.1 + - -1.2 + in: formData + description: Query parameter enum test (double) + responses: + '400': + description: Invalid request + '404': + description: Not found post: tags: - fake @@ -994,6 +1035,31 @@ definitions: foo: type: string readOnly: true + MapTest: + type: object + properties: + map_map_of_string: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + map_map_of_enum: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + enum: + - UPPER + - lower + map_of_enum_string: + type: object + additionalProperties: + type: string + enum: + - UPPER + - lower ArrayTest: type: object properties: @@ -1014,6 +1080,13 @@ definitions: type: array items: $ref: '#/definitions/ReadOnlyFirst' + array_of_enum: + type: array + items: + type: string + enum: + - UPPER + - lower NumberOnly: type: object properties: diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index e3f3ebc3d95..d46556b3ff4 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Debug|Any CPU.Build.0 = Debug|Any CPU -{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Release|Any CPU.ActiveCfg = Release|Any CPU -{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Release|Any CPU.Build.0 = Release|Any CPU +{9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.Debug|Any CPU.Build.0 = Debug|Any CPU +{9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.Release|Any CPU.ActiveCfg = Release|Any CPU +{9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 9d4eeddd49e..e2d622cd13f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-06-21T16:06:28.848+08:00 +- Build date: 2016-06-23T12:09:14.609+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -88,6 +88,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**TestEnumQueryParameters**](docs/FakeApi.md#testenumqueryparameters) | **GET** /fake | To test enum query parameters *PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -116,6 +117,8 @@ Class | Method | HTTP request | Description - [Model.Animal](docs/Animal.md) - [Model.AnimalFarm](docs/AnimalFarm.md) - [Model.ApiResponse](docs/ApiResponse.md) + - [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [Model.ArrayTest](docs/ArrayTest.md) - [Model.Cat](docs/Cat.md) - [Model.Category](docs/Category.md) @@ -124,10 +127,12 @@ Class | Method | HTTP request | Description - [Model.EnumTest](docs/EnumTest.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model.Model200Response](docs/Model200Response.md) - [Model.ModelReturn](docs/ModelReturn.md) - [Model.Name](docs/Name.md) + - [Model.NumberOnly](docs/NumberOnly.md) - [Model.Order](docs/Order.md) - [Model.Pet](docs/Pet.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/SwaggerClient/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..3431d89edd0 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.ArrayOfArrayOfNumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | **List<List<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/docs/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/SwaggerClient/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..9dc573663d6 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/ArrayOfNumberOnly.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.ArrayOfNumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **List<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/docs/ArrayTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/ArrayTest.md index 37fb2788b77..f8f285e08f4 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/ArrayTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/ArrayTest.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes **ArrayOfString** | **List<string>** | | [optional] **ArrayArrayOfInteger** | **List<List<long?>>** | | [optional] **ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] +**ArrayOfEnum** | **List<string>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index cc24d4dfa07..9214eb84b3f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**TestEnumQueryParameters**](FakeApi.md#testenumqueryparameters) | **GET** /fake | To test enum query parameters # **TestEndpointParameters** @@ -89,3 +90,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) +# **TestEnumQueryParameters** +> void TestEnumQueryParameters (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null) + +To test enum query parameters + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestEnumQueryParametersExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) + var enumQueryInteger = 3.4; // decimal? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) + + try + { + // To test enum query parameters + apiInstance.TestEnumQueryParameters(enumQueryString, enumQueryInteger, enumQueryDouble); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestEnumQueryParameters: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] + **enumQueryInteger** | **decimal?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### 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/SwaggerClient/docs/NumberOnly.md b/samples/client/petstore/csharp/SwaggerClient/docs/NumberOnly.md new file mode 100644 index 00000000000..a156dc4e2fc --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/NumberOnly.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.NumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **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/docs/PropertyType.md b/samples/client/petstore/csharp/SwaggerClient/docs/PropertyType.md new file mode 100644 index 00000000000..c99221363d2 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/PropertyType.md @@ -0,0 +1,9 @@ +# 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/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs new file mode 100644 index 00000000000..0ca1df8379b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -0,0 +1,90 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing ArrayOfArrayOfNumberOnly + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class ArrayOfArrayOfNumberOnlyTests + { + // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly + //private ArrayOfArrayOfNumberOnly instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //instance = new ArrayOfArrayOfNumberOnly(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of ArrayOfArrayOfNumberOnly + /// + [Test] + public void ArrayOfArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ArrayOfArrayOfNumberOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly"); + } + + /// + /// Test the property 'ArrayArrayNumber' + /// + [Test] + public void ArrayArrayNumberTest() + { + // TODO unit test for 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 new file mode 100644 index 00000000000..61d53ab7cbf --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayOfNumberOnlyTests.cs @@ -0,0 +1,90 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing ArrayOfNumberOnly + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class ArrayOfNumberOnlyTests + { + // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly + //private ArrayOfNumberOnly instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of ArrayOfNumberOnly + //instance = new ArrayOfNumberOnly(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of ArrayOfNumberOnly + /// + [Test] + public void ArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ArrayOfNumberOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfNumberOnly"); + } + + /// + /// Test the property 'ArrayNumber' + /// + [Test] + public void ArrayNumberTest() + { + // TODO unit test for the property 'ArrayNumber' + } + + } + +} 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 new file mode 100644 index 00000000000..747729a9631 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NumberOnlyTests.cs @@ -0,0 +1,90 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing NumberOnly + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class NumberOnlyTests + { + // TODO uncomment below to declare an instance variable for NumberOnly + //private NumberOnly instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of NumberOnly + //instance = new NumberOnly(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of NumberOnly + /// + [Test] + public void NumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" NumberOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a NumberOnly"); + } + + /// + /// Test the property 'JustNumber' + /// + [Test] + public void JustNumberTest() + { + // TODO unit test for the property 'JustNumber' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PropertyTypeTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PropertyTypeTests.cs new file mode 100644 index 00000000000..b9ce00f98eb --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PropertyTypeTests.cs @@ -0,0 +1,90 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing PropertyType + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class PropertyTypeTests + { + // TODO uncomment below to declare an instance variable for PropertyType + //private PropertyType instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of PropertyType + //instance = new PropertyType(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of PropertyType + /// + [Test] + public void PropertyTypeInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" PropertyType + //Assert.IsInstanceOfType (instance, "variable 'instance' is a PropertyType"); + } + + /// + /// Test the property 'Type' + /// + [Test] + public void TypeTest() + { + // TODO unit test for the property '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 973771809a2..6cdf4d3470e 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 @@ -78,6 +78,31 @@ namespace IO.Swagger.Api /// None (optional) /// ApiResponse of Object(void) ApiResponse TestEndpointParametersWithHttpInfo (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + /// + /// To test enum query parameters + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// + void TestEnumQueryParameters (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null); + + /// + /// To test enum query parameters + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// ApiResponse of Object(void) + ApiResponse TestEnumQueryParametersWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -123,6 +148,31 @@ namespace IO.Swagger.Api /// None (optional) /// Task of ApiResponse System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + /// + /// To test enum query parameters + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Task of void + System.Threading.Tasks.Task TestEnumQueryParametersAsync (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null); + + /// + /// To test enum query parameters + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEnumQueryParametersAsyncWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null); #endregion Asynchronous Operations } @@ -459,6 +509,153 @@ namespace IO.Swagger.Api } + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// To test enum query parameters + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// + public void TestEnumQueryParameters (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null) + { + TestEnumQueryParametersWithHttpInfo(enumQueryString, enumQueryInteger, enumQueryDouble); + } + + /// + /// To test enum query parameters + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// ApiResponse of Object(void) + public ApiResponse TestEnumQueryParametersWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null) + { + + var localVarPath = "/fake"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + 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); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter + if (enumQueryString != null) localVarFormParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // form parameter + if (enumQueryDouble != null) localVarFormParams.Add("enum_query_double", Configuration.ApiClient.ParameterToString(enumQueryDouble)); // 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("TestEnumQueryParameters", localVarResponse); + if (exception != null) throw exception; + } + + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// To test enum query parameters + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Task of void + public async System.Threading.Tasks.Task TestEnumQueryParametersAsync (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null) + { + await TestEnumQueryParametersAsyncWithHttpInfo(enumQueryString, enumQueryInteger, enumQueryDouble); + + } + + /// + /// To test enum query parameters + /// + /// Thrown when fails to make API call + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEnumQueryParametersAsyncWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null) + { + + var localVarPath = "/fake"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + 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); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter + if (enumQueryString != null) localVarFormParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // form parameter + if (enumQueryDouble != null) localVarFormParams.Add("enum_query_double", Configuration.ApiClient.ParameterToString(enumQueryDouble)); // 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("TestEnumQueryParameters", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null); 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 5ad82368d71..0dfaea20cd8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {EC130B5E-75A2-4FA3-BEE2-634A4FFF231C} + {9391D4F3-E89A-41F1-B1C9-A9C885B3F96D} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs new file mode 100644 index 00000000000..a4da5ca286a --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs @@ -0,0 +1,126 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// ArrayOfArrayOfNumberOnly + /// + [DataContract] + public partial class ArrayOfArrayOfNumberOnly : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// ArrayArrayNumber. + public ArrayOfArrayOfNumberOnly(List> ArrayArrayNumber = null) + { + this.ArrayArrayNumber = ArrayArrayNumber; + } + + /// + /// Gets or Sets ArrayArrayNumber + /// + [DataMember(Name="ArrayArrayNumber", EmitDefaultValue=false)] + public List> ArrayArrayNumber { 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 ArrayOfArrayOfNumberOnly {\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).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 ArrayOfArrayOfNumberOnly); + } + + /// + /// Returns true if ArrayOfArrayOfNumberOnly instances are equal + /// + /// Instance of ArrayOfArrayOfNumberOnly to be compared + /// Boolean + public bool Equals(ArrayOfArrayOfNumberOnly other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.ArrayArrayNumber == other.ArrayArrayNumber || + this.ArrayArrayNumber != null && + this.ArrayArrayNumber.SequenceEqual(other.ArrayArrayNumber) + ); + } + + /// + /// 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.ArrayArrayNumber != null) + hash = hash * 59 + this.ArrayArrayNumber.GetHashCode(); + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs new file mode 100644 index 00000000000..977f8c9a7ef --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs @@ -0,0 +1,126 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// ArrayOfNumberOnly + /// + [DataContract] + public partial class ArrayOfNumberOnly : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// ArrayNumber. + public ArrayOfNumberOnly(List ArrayNumber = null) + { + this.ArrayNumber = ArrayNumber; + } + + /// + /// Gets or Sets ArrayNumber + /// + [DataMember(Name="ArrayNumber", EmitDefaultValue=false)] + public List ArrayNumber { 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 ArrayOfNumberOnly {\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).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 ArrayOfNumberOnly); + } + + /// + /// Returns true if ArrayOfNumberOnly instances are equal + /// + /// Instance of ArrayOfNumberOnly to be compared + /// Boolean + public bool Equals(ArrayOfNumberOnly other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.ArrayNumber == other.ArrayNumber || + this.ArrayNumber != null && + this.ArrayNumber.SequenceEqual(other.ArrayNumber) + ); + } + + /// + /// 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.ArrayNumber != null) + hash = hash * 59 + this.ArrayNumber.GetHashCode(); + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs index b80118c790f..f0a57effc33 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs @@ -39,17 +39,45 @@ namespace IO.Swagger.Model [DataContract] public partial class ArrayTest : IEquatable { + + /// + /// Gets or Sets ArrayOfEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayOfEnumEnum + { + + /// + /// Enum Upper for "UPPER" + /// + [EnumMember(Value = "UPPER")] + Upper, + + /// + /// Enum Lower for "lower" + /// + [EnumMember(Value = "lower")] + Lower + } + + /// + /// Gets or Sets ArrayOfEnum + /// + [DataMember(Name="array_of_enum", EmitDefaultValue=false)] + public List ArrayOfEnum { get; set; } /// /// Initializes a new instance of the class. /// /// ArrayOfString. /// ArrayArrayOfInteger. /// ArrayArrayOfModel. - public ArrayTest(List ArrayOfString = null, List> ArrayArrayOfInteger = null, List> ArrayArrayOfModel = null) + /// ArrayOfEnum. + public ArrayTest(List ArrayOfString = null, List> ArrayArrayOfInteger = null, List> ArrayArrayOfModel = null, List ArrayOfEnum = null) { this.ArrayOfString = ArrayOfString; this.ArrayArrayOfInteger = ArrayArrayOfInteger; this.ArrayArrayOfModel = ArrayArrayOfModel; + this.ArrayOfEnum = ArrayOfEnum; } /// @@ -78,6 +106,7 @@ namespace IO.Swagger.Model sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); + sb.Append(" ArrayOfEnum: ").Append(ArrayOfEnum).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -128,6 +157,11 @@ namespace IO.Swagger.Model this.ArrayArrayOfModel == other.ArrayArrayOfModel || this.ArrayArrayOfModel != null && this.ArrayArrayOfModel.SequenceEqual(other.ArrayArrayOfModel) + ) && + ( + this.ArrayOfEnum == other.ArrayOfEnum || + this.ArrayOfEnum != null && + this.ArrayOfEnum.SequenceEqual(other.ArrayOfEnum) ); } @@ -148,6 +182,8 @@ namespace IO.Swagger.Model hash = hash * 59 + this.ArrayArrayOfInteger.GetHashCode(); if (this.ArrayArrayOfModel != null) hash = hash * 59 + this.ArrayArrayOfModel.GetHashCode(); + if (this.ArrayOfEnum != null) + hash = hash * 59 + this.ArrayOfEnum.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs new file mode 100644 index 00000000000..06c953ce89d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs @@ -0,0 +1,126 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// NumberOnly + /// + [DataContract] + public partial class NumberOnly : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// JustNumber. + public NumberOnly(decimal? JustNumber = null) + { + this.JustNumber = JustNumber; + } + + /// + /// Gets or Sets JustNumber + /// + [DataMember(Name="JustNumber", EmitDefaultValue=false)] + public decimal? JustNumber { 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 NumberOnly {\n"); + sb.Append(" JustNumber: ").Append(JustNumber).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 NumberOnly); + } + + /// + /// Returns true if NumberOnly instances are equal + /// + /// Instance of NumberOnly to be compared + /// Boolean + public bool Equals(NumberOnly other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.JustNumber == other.JustNumber || + this.JustNumber != null && + this.JustNumber.Equals(other.JustNumber) + ); + } + + /// + /// 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.JustNumber != null) + hash = hash * 59 + this.JustNumber.GetHashCode(); + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/PropertyType.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/PropertyType.cs new file mode 100644 index 00000000000..e36e777d975 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/PropertyType.cs @@ -0,0 +1,126 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// PropertyType + /// + [DataContract] + public partial class PropertyType : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Type. + public PropertyType(decimal? Type = null) + { + this.Type = Type; + } + + /// + /// Gets or Sets Type + /// + [DataMember(Name="type", EmitDefaultValue=false)] + public decimal? Type { 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 PropertyType {\n"); + sb.Append(" Type: ").Append(Type).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 PropertyType); + } + + /// + /// Returns true if PropertyType instances are equal + /// + /// Instance of PropertyType to be compared + /// Boolean + public bool Equals(PropertyType other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Type == other.Type || + this.Type != null && + this.Type.Equals(other.Type) + ); + } + + /// + /// 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.Type != null) + hash = hash * 59 + this.Type.GetHashCode(); + return hash; + } + } + } + +}