add array and map of enum support for C#

This commit is contained in:
wing328
2016-06-23 12:14:32 +08:00
parent eda6d35b9f
commit c15992b420
23 changed files with 1491 additions and 104 deletions

View File

@@ -223,58 +223,12 @@ public class DefaultCodegen {
cm.allowableValues.put("enumVars", enumVars); 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) { for (CodegenProperty var : cm.vars) {
Map<String, Object> allowableValues = var.allowableValues; updateCodegenPropertyEnum(var);
// handle ArrayProperty
if (var.items != null) {
allowableValues = var.items.allowableValues;
}
if (allowableValues == null) {
continue;
}
//List<String> values = (List<String>) allowableValues.get("values");
List<Object> values = (List<Object>) allowableValues.get("values");
if (values == null) {
continue;
}
// put "enumVars" map into `allowableValues", including `name` and `value`
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
String commonPrefix = findCommonPrefixOfVars(values);
int truncateIdx = commonPrefix.length();
for (Object value : values) {
Map<String, String> enumVar = new HashMap<String, String>();
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<String, String> 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);
}
}
} }
} }
return objs; return objs;
} }
@@ -1572,48 +1526,137 @@ public class DefaultCodegen {
property.baseType = getSwaggerType(p); property.baseType = getSwaggerType(p);
if (p instanceof ArrayProperty) { if (p instanceof ArrayProperty) {
property.isContainer = true; property.isContainer = true;
property.isListContainer = true; property.isListContainer = true;
property.containerType = "array"; property.containerType = "array";
ArrayProperty ap = (ArrayProperty) p; property.baseType = getSwaggerType(p);
CodegenProperty cp = fromProperty(property.name, ap.getItems()); // handle inner property
if (cp == null) { ArrayProperty ap = (ArrayProperty) p;
LOGGER.warn("skipping invalid property " + Json.pretty(p)); CodegenProperty cp = fromProperty(property.name, ap.getItems());
} else { updatePropertyForArray(property, cp);
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);
}
}
} else if (p instanceof MapProperty) { } else if (p instanceof MapProperty) {
property.isContainer = true; property.isContainer = true;
property.isMapContainer = true; property.isMapContainer = true;
property.containerType = "map"; property.containerType = "map";
property.baseType = getSwaggerType(p);
// handle inner property
MapProperty ap = (MapProperty) p; MapProperty ap = (MapProperty) p;
CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties()); CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties());
property.items = cp; updatePropertyForMap(property, cp);
property.baseType = getSwaggerType(p);
if (!languageSpecificPrimitives.contains(cp.baseType)) {
property.complexType = cp.baseType;
} else {
property.isPrimitiveType = true;
}
} else { } else {
setNonArrayMapProperty(property, type); setNonArrayMapProperty(property, type);
} }
return property; 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<string> => List<StatusEnum>
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<string, string> => Dictionary<string, StatusEnum>
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) { protected void setNonArrayMapProperty(CodegenProperty property, String type) {
property.isNotContainer = true; property.isNotContainer = true;
if (languageSpecificPrimitives().contains(type)) { 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"); 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 = new StringProperty().description("//TODO automatically added by swagger-codegen. Type was " + type + " but not supported");
} }
property.setRequired(param.getRequired()); property.setRequired(param.getRequired());
CodegenProperty model = fromProperty(qp.getName(), property); CodegenProperty cp = fromProperty(qp.getName(), property);
// set boolean flag (e.g. isString) // set boolean flag (e.g. isString)
setParameterBooleanFlagWithCodegenProperty(p, model); setParameterBooleanFlagWithCodegenProperty(p, cp);
p.dataType = model.datatype; p.dataType = cp.datatype;
if(model.isEnum) { if(cp.isEnum) {
p.datatypeWithEnum = model.datatypeWithEnum; p.datatypeWithEnum = cp.datatypeWithEnum;
} }
p.isEnum = model.isEnum;
p._enum = model._enum; // enum
p.allowableValues = model.allowableValues; updateCodegenPropertyEnum(cp);
if(model.items != null && model.items.isEnum) { p.isEnum = cp.isEnum;
p.datatypeWithEnum = model.datatypeWithEnum; p._enum = cp._enum;
p.items = model.items; p.allowableValues = cp.allowableValues;
if (cp.items != null && cp.items.isEnum) {
p.datatypeWithEnum = cp.datatypeWithEnum;
p.items = cp.items;
} }
p.collectionFormat = collectionFormat; p.collectionFormat = collectionFormat;
if(collectionFormat != null && collectionFormat.equals("multi")) { if(collectionFormat != null && collectionFormat.equals("multi")) {
@@ -2087,10 +2136,12 @@ public class DefaultCodegen {
} }
p.paramName = toParamName(qp.getName()); p.paramName = toParamName(qp.getName());
if (model.complexType != null) { // import
imports.add(model.complexType); if (cp.complexType != null) {
imports.add(cp.complexType);
} }
// validation
p.maximum = qp.getMaximum(); p.maximum = qp.getMaximum();
p.exclusiveMaximum = qp.isExclusiveMaximum(); p.exclusiveMaximum = qp.isExclusiveMaximum();
p.minimum = qp.getMinimum(); p.minimum = qp.getMinimum();
@@ -3026,4 +3077,63 @@ public class DefaultCodegen {
LOGGER.debug("Property type is not primitive: " + property.datatype); 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<String, Object> allowableValues = var.allowableValues;
// handle ArrayProperty
if (var.items != null) {
allowableValues = var.items.allowableValues;
}
if (allowableValues == null) {
return;
}
//List<String> values = (List<String>) allowableValues.get("values");
List<Object> values = (List<Object>) allowableValues.get("values");
if (values == null) {
return;
}
// put "enumVars" map into `allowableValues", including `name` and `value`
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
String commonPrefix = findCommonPrefixOfVars(values);
int truncateIdx = commonPrefix.length();
for (Object value : values) {
Map<String, String> enumVar = new HashMap<String, String>();
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<String, String> 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);
}
}
}
} }

View File

@@ -21,7 +21,7 @@
/// </summary>{{#description}} /// </summary>{{#description}}
/// <value>{{{description}}}</value>{{/description}} /// <value>{{{description}}}</value>{{/description}}
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
public {{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} { get; set; } public {{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}?{{/isContainer}}{{/isEnum}} {{name}} { get; set; }
{{/isEnum}} {{/isEnum}}
{{/vars}} {{/vars}}
{{#hasRequired}} {{#hasRequired}}
@@ -44,7 +44,7 @@
{{#hasOnlyReadOnly}} {{#hasOnlyReadOnly}}
[JsonConstructorAttribute] [JsonConstructorAttribute]
{{/hasOnlyReadOnly}} {{/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}} {{#vars}}
{{^isReadOnly}} {{^isReadOnly}}

View File

@@ -1,9 +1,10 @@
{{^isContainer}}
/// <summary> /// <summary>
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
/// </summary>{{#description}} /// </summary>{{#description}}
/// <value>{{{description}}}</value>{{/description}} /// <value>{{{description}}}</value>{{/description}}
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} public enum {{#datatypeWithEnum}}{{&.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
{ {
{{#allowableValues}}{{#enumVars}} {{#allowableValues}}{{#enumVars}}
/// <summary> /// <summary>
@@ -13,3 +14,4 @@
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}} {{/-last}}{{/enumVars}}{{/allowableValues}}
} }
{{/isContainer}}

View File

@@ -561,6 +561,47 @@ paths:
description: User not found description: User not found
/fake: /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: post:
tags: tags:
- fake - fake
@@ -994,6 +1035,31 @@ definitions:
foo: foo:
type: string type: string
readOnly: true 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: ArrayTest:
type: object type: object
properties: properties:
@@ -1014,6 +1080,13 @@ definitions:
type: array type: array
items: items:
$ref: '#/definitions/ReadOnlyFirst' $ref: '#/definitions/ReadOnlyFirst'
array_of_enum:
type: array
items:
type: string
enum:
- UPPER
- lower
NumberOnly: NumberOnly:
type: object type: object
properties: properties:

View File

@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
VisualStudioVersion = 12.0.0.0 VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject EndProject
@@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Debug|Any CPU.Build.0 = Debug|Any CPU {9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}.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}.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.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = 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 {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
- API version: 1.0.0 - API version: 1.0.0
- SDK 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 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen
## Frameworks supported ## Frameworks supported
@@ -88,6 +88,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *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* | [**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* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *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.Animal](docs/Animal.md)
- [Model.AnimalFarm](docs/AnimalFarm.md) - [Model.AnimalFarm](docs/AnimalFarm.md)
- [Model.ApiResponse](docs/ApiResponse.md) - [Model.ApiResponse](docs/ApiResponse.md)
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md) - [Model.ArrayTest](docs/ArrayTest.md)
- [Model.Cat](docs/Cat.md) - [Model.Cat](docs/Cat.md)
- [Model.Category](docs/Category.md) - [Model.Category](docs/Category.md)
@@ -124,10 +127,12 @@ Class | Method | HTTP request | Description
- [Model.EnumTest](docs/EnumTest.md) - [Model.EnumTest](docs/EnumTest.md)
- [Model.FormatTest](docs/FormatTest.md) - [Model.FormatTest](docs/FormatTest.md)
- [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Model.MapTest](docs/MapTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](docs/Model200Response.md) - [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelReturn](docs/ModelReturn.md) - [Model.ModelReturn](docs/ModelReturn.md)
- [Model.Name](docs/Name.md) - [Model.Name](docs/Name.md)
- [Model.NumberOnly](docs/NumberOnly.md)
- [Model.Order](docs/Order.md) - [Model.Order](docs/Order.md)
- [Model.Pet](docs/Pet.md) - [Model.Pet](docs/Pet.md)
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)

View File

@@ -0,0 +1,9 @@
# IO.Swagger.Model.ArrayOfArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayArrayNumber** | **List&lt;List&lt;decimal?&gt;&gt;** | | [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)

View File

@@ -0,0 +1,9 @@
# IO.Swagger.Model.ArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayNumber** | **List&lt;decimal?&gt;** | | [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)

View File

@@ -6,6 +6,7 @@ Name | Type | Description | Notes
**ArrayOfString** | **List&lt;string&gt;** | | [optional] **ArrayOfString** | **List&lt;string&gt;** | | [optional]
**ArrayArrayOfInteger** | **List&lt;List&lt;long?&gt;&gt;** | | [optional] **ArrayArrayOfInteger** | **List&lt;List&lt;long?&gt;&gt;** | | [optional]
**ArrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional] **ArrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional]
**ArrayOfEnum** | **List&lt;string&gt;** | | [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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**TestEnumQueryParameters**](FakeApi.md#testenumqueryparameters) | **GET** /fake | To test enum query parameters
# **TestEndpointParameters** # **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) [[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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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
{
/// <summary>
/// Class for testing ArrayOfArrayOfNumberOnly
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class ArrayOfArrayOfNumberOnlyTests
{
// TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly
//private ArrayOfArrayOfNumberOnly instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly
//instance = new ArrayOfArrayOfNumberOnly();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of ArrayOfArrayOfNumberOnly
/// </summary>
[Test]
public void ArrayOfArrayOfNumberOnlyInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" ArrayOfArrayOfNumberOnly
//Assert.IsInstanceOfType<ArrayOfArrayOfNumberOnly> (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly");
}
/// <summary>
/// Test the property 'ArrayArrayNumber'
/// </summary>
[Test]
public void ArrayArrayNumberTest()
{
// TODO unit test for the property 'ArrayArrayNumber'
}
}
}

View File

@@ -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
{
/// <summary>
/// Class for testing ArrayOfNumberOnly
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class ArrayOfNumberOnlyTests
{
// TODO uncomment below to declare an instance variable for ArrayOfNumberOnly
//private ArrayOfNumberOnly instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of ArrayOfNumberOnly
//instance = new ArrayOfNumberOnly();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of ArrayOfNumberOnly
/// </summary>
[Test]
public void ArrayOfNumberOnlyInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" ArrayOfNumberOnly
//Assert.IsInstanceOfType<ArrayOfNumberOnly> (instance, "variable 'instance' is a ArrayOfNumberOnly");
}
/// <summary>
/// Test the property 'ArrayNumber'
/// </summary>
[Test]
public void ArrayNumberTest()
{
// TODO unit test for the property 'ArrayNumber'
}
}
}

View File

@@ -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
{
/// <summary>
/// Class for testing NumberOnly
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class NumberOnlyTests
{
// TODO uncomment below to declare an instance variable for NumberOnly
//private NumberOnly instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of NumberOnly
//instance = new NumberOnly();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of NumberOnly
/// </summary>
[Test]
public void NumberOnlyInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" NumberOnly
//Assert.IsInstanceOfType<NumberOnly> (instance, "variable 'instance' is a NumberOnly");
}
/// <summary>
/// Test the property 'JustNumber'
/// </summary>
[Test]
public void JustNumberTest()
{
// TODO unit test for the property 'JustNumber'
}
}
}

View File

@@ -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
{
/// <summary>
/// Class for testing PropertyType
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class PropertyTypeTests
{
// TODO uncomment below to declare an instance variable for PropertyType
//private PropertyType instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of PropertyType
//instance = new PropertyType();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of PropertyType
/// </summary>
[Test]
public void PropertyTypeInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" PropertyType
//Assert.IsInstanceOfType<PropertyType> (instance, "variable 'instance' is a PropertyType");
}
/// <summary>
/// Test the property 'Type'
/// </summary>
[Test]
public void TypeTest()
{
// TODO unit test for the property 'Type'
}
}
}

View File

@@ -78,6 +78,31 @@ namespace IO.Swagger.Api
/// <param name="password">None (optional)</param> /// <param name="password">None (optional)</param>
/// <returns>ApiResponse of Object(void)</returns> /// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> 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); ApiResponse<Object> 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);
/// <summary>
/// To test enum query parameters
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns></returns>
void TestEnumQueryParameters (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null);
/// <summary>
/// To test enum query parameters
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestEnumQueryParametersWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null);
#endregion Synchronous Operations #endregion Synchronous Operations
#region Asynchronous Operations #region Asynchronous Operations
/// <summary> /// <summary>
@@ -123,6 +148,31 @@ namespace IO.Swagger.Api
/// <param name="password">None (optional)</param> /// <param name="password">None (optional)</param>
/// <returns>Task of ApiResponse</returns> /// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> 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); System.Threading.Tasks.Task<ApiResponse<Object>> 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);
/// <summary>
/// To test enum query parameters
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task TestEnumQueryParametersAsync (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null);
/// <summary>
/// To test enum query parameters
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumQueryParametersAsyncWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null);
#endregion Asynchronous Operations #endregion Asynchronous Operations
} }
@@ -459,6 +509,153 @@ namespace IO.Swagger.Api
} }
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);
}
/// <summary>
/// To test enum query parameters
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns></returns>
public void TestEnumQueryParameters (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null)
{
TestEnumQueryParametersWithHttpInfo(enumQueryString, enumQueryInteger, enumQueryDouble);
}
/// <summary>
/// To test enum query parameters
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns>ApiResponse of Object(void)</returns>
public ApiResponse<Object> TestEnumQueryParametersWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null)
{
var localVarPath = "/fake";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new Dictionary<String, String>();
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
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<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);
}
/// <summary>
/// To test enum query parameters
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task TestEnumQueryParametersAsync (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null)
{
await TestEnumQueryParametersAsyncWithHttpInfo(enumQueryString, enumQueryInteger, enumQueryDouble);
}
/// <summary>
/// To test enum query parameters
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="enumQueryString">Query parameter enum test (string) (optional, default to -efg)</param>
/// <param name="enumQueryInteger">Query parameter enum test (double) (optional)</param>
/// <param name="enumQueryDouble">Query parameter enum test (double) (optional)</param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumQueryParametersAsyncWithHttpInfo (string enumQueryString = null, decimal? enumQueryInteger = null, double? enumQueryDouble = null)
{
var localVarPath = "/fake";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new Dictionary<String, String>();
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
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<Object>(localVarStatusCode, return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null); null);

View File

@@ -24,7 +24,7 @@ limitations under the License.
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EC130B5E-75A2-4FA3-BEE2-634A4FFF231C}</ProjectGuid> <ProjectGuid>{9391D4F3-E89A-41F1-B1C9-A9C885B3F96D}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swagger Library</RootNamespace> <RootNamespace>Swagger Library</RootNamespace>

View File

@@ -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
{
/// <summary>
/// ArrayOfArrayOfNumberOnly
/// </summary>
[DataContract]
public partial class ArrayOfArrayOfNumberOnly : IEquatable<ArrayOfArrayOfNumberOnly>
{
/// <summary>
/// Initializes a new instance of the <see cref="ArrayOfArrayOfNumberOnly" /> class.
/// </summary>
/// <param name="ArrayArrayNumber">ArrayArrayNumber.</param>
public ArrayOfArrayOfNumberOnly(List<List<decimal?>> ArrayArrayNumber = null)
{
this.ArrayArrayNumber = ArrayArrayNumber;
}
/// <summary>
/// Gets or Sets ArrayArrayNumber
/// </summary>
[DataMember(Name="ArrayArrayNumber", EmitDefaultValue=false)]
public List<List<decimal?>> ArrayArrayNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
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();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as ArrayOfArrayOfNumberOnly);
}
/// <summary>
/// Returns true if ArrayOfArrayOfNumberOnly instances are equal
/// </summary>
/// <param name="other">Instance of ArrayOfArrayOfNumberOnly to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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;
}
}
}
}

View File

@@ -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
{
/// <summary>
/// ArrayOfNumberOnly
/// </summary>
[DataContract]
public partial class ArrayOfNumberOnly : IEquatable<ArrayOfNumberOnly>
{
/// <summary>
/// Initializes a new instance of the <see cref="ArrayOfNumberOnly" /> class.
/// </summary>
/// <param name="ArrayNumber">ArrayNumber.</param>
public ArrayOfNumberOnly(List<decimal?> ArrayNumber = null)
{
this.ArrayNumber = ArrayNumber;
}
/// <summary>
/// Gets or Sets ArrayNumber
/// </summary>
[DataMember(Name="ArrayNumber", EmitDefaultValue=false)]
public List<decimal?> ArrayNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
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();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as ArrayOfNumberOnly);
}
/// <summary>
/// Returns true if ArrayOfNumberOnly instances are equal
/// </summary>
/// <param name="other">Instance of ArrayOfNumberOnly to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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;
}
}
}
}

View File

@@ -39,17 +39,45 @@ namespace IO.Swagger.Model
[DataContract] [DataContract]
public partial class ArrayTest : IEquatable<ArrayTest> public partial class ArrayTest : IEquatable<ArrayTest>
{ {
/// <summary>
/// Gets or Sets ArrayOfEnum
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ArrayOfEnumEnum
{
/// <summary>
/// Enum Upper for "UPPER"
/// </summary>
[EnumMember(Value = "UPPER")]
Upper,
/// <summary>
/// Enum Lower for "lower"
/// </summary>
[EnumMember(Value = "lower")]
Lower
}
/// <summary>
/// Gets or Sets ArrayOfEnum
/// </summary>
[DataMember(Name="array_of_enum", EmitDefaultValue=false)]
public List<ArrayOfEnumEnum> ArrayOfEnum { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ArrayTest" /> class. /// Initializes a new instance of the <see cref="ArrayTest" /> class.
/// </summary> /// </summary>
/// <param name="ArrayOfString">ArrayOfString.</param> /// <param name="ArrayOfString">ArrayOfString.</param>
/// <param name="ArrayArrayOfInteger">ArrayArrayOfInteger.</param> /// <param name="ArrayArrayOfInteger">ArrayArrayOfInteger.</param>
/// <param name="ArrayArrayOfModel">ArrayArrayOfModel.</param> /// <param name="ArrayArrayOfModel">ArrayArrayOfModel.</param>
public ArrayTest(List<string> ArrayOfString = null, List<List<long?>> ArrayArrayOfInteger = null, List<List<ReadOnlyFirst>> ArrayArrayOfModel = null) /// <param name="ArrayOfEnum">ArrayOfEnum.</param>
public ArrayTest(List<string> ArrayOfString = null, List<List<long?>> ArrayArrayOfInteger = null, List<List<ReadOnlyFirst>> ArrayArrayOfModel = null, List<ArrayOfEnumEnum> ArrayOfEnum = null)
{ {
this.ArrayOfString = ArrayOfString; this.ArrayOfString = ArrayOfString;
this.ArrayArrayOfInteger = ArrayArrayOfInteger; this.ArrayArrayOfInteger = ArrayArrayOfInteger;
this.ArrayArrayOfModel = ArrayArrayOfModel; this.ArrayArrayOfModel = ArrayArrayOfModel;
this.ArrayOfEnum = ArrayOfEnum;
} }
/// <summary> /// <summary>
@@ -78,6 +106,7 @@ namespace IO.Swagger.Model
sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n");
sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n");
sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n");
sb.Append(" ArrayOfEnum: ").Append(ArrayOfEnum).Append("\n");
sb.Append("}\n"); sb.Append("}\n");
return sb.ToString(); return sb.ToString();
} }
@@ -128,6 +157,11 @@ namespace IO.Swagger.Model
this.ArrayArrayOfModel == other.ArrayArrayOfModel || this.ArrayArrayOfModel == other.ArrayArrayOfModel ||
this.ArrayArrayOfModel != null && this.ArrayArrayOfModel != null &&
this.ArrayArrayOfModel.SequenceEqual(other.ArrayArrayOfModel) 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(); hash = hash * 59 + this.ArrayArrayOfInteger.GetHashCode();
if (this.ArrayArrayOfModel != null) if (this.ArrayArrayOfModel != null)
hash = hash * 59 + this.ArrayArrayOfModel.GetHashCode(); hash = hash * 59 + this.ArrayArrayOfModel.GetHashCode();
if (this.ArrayOfEnum != null)
hash = hash * 59 + this.ArrayOfEnum.GetHashCode();
return hash; return hash;
} }
} }

View File

@@ -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
{
/// <summary>
/// NumberOnly
/// </summary>
[DataContract]
public partial class NumberOnly : IEquatable<NumberOnly>
{
/// <summary>
/// Initializes a new instance of the <see cref="NumberOnly" /> class.
/// </summary>
/// <param name="JustNumber">JustNumber.</param>
public NumberOnly(decimal? JustNumber = null)
{
this.JustNumber = JustNumber;
}
/// <summary>
/// Gets or Sets JustNumber
/// </summary>
[DataMember(Name="JustNumber", EmitDefaultValue=false)]
public decimal? JustNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
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();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as NumberOnly);
}
/// <summary>
/// Returns true if NumberOnly instances are equal
/// </summary>
/// <param name="other">Instance of NumberOnly to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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;
}
}
}
}

View File

@@ -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
{
/// <summary>
/// PropertyType
/// </summary>
[DataContract]
public partial class PropertyType : IEquatable<PropertyType>
{
/// <summary>
/// Initializes a new instance of the <see cref="PropertyType" /> class.
/// </summary>
/// <param name="Type">Type.</param>
public PropertyType(decimal? Type = null)
{
this.Type = Type;
}
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
public decimal? Type { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
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();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as PropertyType);
}
/// <summary>
/// Returns true if PropertyType instances are equal
/// </summary>
/// <param name="other">Instance of PropertyType to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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;
}
}
}
}