forked from loafle/openapi-generator-original
fix double byte characters in description, upgrade to lang3
This commit is contained in:
parent
5a7e0fd181
commit
3a80a4ff1e
@ -252,8 +252,8 @@
|
|||||||
<version>${slf4j-version}</version>
|
<version>${slf4j-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-lang</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>${commons-lang-version}</version>
|
<version>${commons-lang-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -9,8 +9,8 @@ import io.swagger.models.parameters.*;
|
|||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import io.swagger.models.properties.PropertyBuilder.PropertyId;
|
import io.swagger.models.properties.PropertyBuilder.PropertyId;
|
||||||
import io.swagger.util.Json;
|
import io.swagger.util.Json;
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ public class DefaultCodegen {
|
|||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String escapeText(String input) {
|
public String escapeText(String input) {
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
return StringEscapeUtils.escapeJava(input).replace("\\/", "/");
|
return StringEscapeUtils.unescapeJava(StringEscapeUtils.escapeJava(input).replace("\\/", "/")).replaceAll("[\\t\\n\\r]"," ");
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package io.swagger.codegen.languages;
|
|||||||
|
|
||||||
import io.swagger.codegen.*;
|
import io.swagger.codegen.*;
|
||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import io.swagger.models.properties.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import io.swagger.models.properties.LongProperty;
|
|||||||
import io.swagger.models.properties.MapProperty;
|
import io.swagger.models.properties.MapProperty;
|
||||||
import io.swagger.models.properties.Property;
|
import io.swagger.models.properties.Property;
|
||||||
import io.swagger.models.properties.StringProperty;
|
import io.swagger.models.properties.StringProperty;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import java.io.File;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package io.swagger.codegen.languages;
|
|||||||
|
|
||||||
import io.swagger.codegen.*;
|
import io.swagger.codegen.*;
|
||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ import java.util.Map;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.models.Contact;
|
|||||||
import io.swagger.models.Info;
|
import io.swagger.models.Info;
|
||||||
import io.swagger.models.License;
|
import io.swagger.models.License;
|
||||||
import io.swagger.models.Swagger;
|
import io.swagger.models.Swagger;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -17,7 +17,7 @@ import io.swagger.models.properties.LongProperty;
|
|||||||
import io.swagger.models.properties.MapProperty;
|
import io.swagger.models.properties.MapProperty;
|
||||||
import io.swagger.models.properties.Property;
|
import io.swagger.models.properties.Property;
|
||||||
import io.swagger.models.properties.StringProperty;
|
import io.swagger.models.properties.StringProperty;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -9,7 +9,7 @@ import io.swagger.models.parameters.Parameter;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -450,4 +450,4 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public void setPackageVersion(String packageVersion) {
|
public void setPackageVersion(String packageVersion) {
|
||||||
this.packageVersion = packageVersion;
|
this.packageVersion = packageVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,4 +183,4 @@ public class JMeterCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
type = swaggerType;
|
type = swaggerType;
|
||||||
return toModelName(type);
|
return toModelName(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@ import io.swagger.models.Swagger;
|
|||||||
import io.swagger.models.parameters.FormParameter;
|
import io.swagger.models.parameters.FormParameter;
|
||||||
import io.swagger.models.parameters.Parameter;
|
import io.swagger.models.parameters.Parameter;
|
||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import org.apache.commons.lang.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang.WordUtils;
|
//import org.apache.commons.lang3.WordUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import io.swagger.codegen.*;
|
|||||||
import io.swagger.models.Operation;
|
import io.swagger.models.Operation;
|
||||||
import io.swagger.models.Path;
|
import io.swagger.models.Path;
|
||||||
import io.swagger.models.Swagger;
|
import io.swagger.models.Swagger;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -33,7 +33,7 @@ import io.swagger.models.properties.Property;
|
|||||||
import io.swagger.models.properties.RefProperty;
|
import io.swagger.models.properties.RefProperty;
|
||||||
import io.swagger.models.properties.StringProperty;
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import java.util.TreeSet;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
public JavascriptClosureAngularClientCodegen() {
|
public JavascriptClosureAngularClientCodegen() {
|
||||||
|
@ -232,4 +232,4 @@ public class LumenServerCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
type = swaggerType;
|
type = swaggerType;
|
||||||
return toModelName(type);
|
return toModelName(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
public static final String CLASS_PREFIX = "classPrefix";
|
public static final String CLASS_PREFIX = "classPrefix";
|
||||||
|
@ -27,7 +27,7 @@ import java.util.Arrays;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
public static final String MODULE_NAME = "moduleName";
|
public static final String MODULE_NAME = "moduleName";
|
||||||
|
@ -13,7 +13,7 @@ import java.io.File;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
protected String packageName;
|
protected String packageName;
|
||||||
|
@ -19,7 +19,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
protected String invokerPackage = "io.swagger.client";
|
protected String invokerPackage = "io.swagger.client";
|
||||||
|
@ -17,7 +17,7 @@ import java.util.Arrays;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -85,4 +85,4 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public String modelFileFolder() {
|
public String modelFileFolder() {
|
||||||
return outputFolder + File.separator + sourceFolder + File.separator + "models";
|
return outputFolder + File.separator + sourceFolder + File.separator + "models";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,4 +101,4 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
|
|||||||
}
|
}
|
||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,4 +52,4 @@ public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
|||||||
LOGGER.error(e.getMessage(), e);
|
LOGGER.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,4 +51,4 @@ public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfi
|
|||||||
LOGGER.error(e.getMessage(), e);
|
LOGGER.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@ import io.swagger.models.parameters.Parameter;
|
|||||||
import io.swagger.models.properties.ArrayProperty;
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
import io.swagger.models.properties.MapProperty;
|
import io.swagger.models.properties.MapProperty;
|
||||||
import io.swagger.models.properties.Property;
|
import io.swagger.models.properties.Property;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -25,7 +25,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class TizenClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class TizenClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
protected static String PREFIX = "Sami";
|
protected static String PREFIX = "Sami";
|
||||||
|
@ -12,7 +12,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
@ -564,8 +564,16 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- fake
|
- fake
|
||||||
summary: Fake endpoint for testing various parameters
|
summary: |
|
||||||
description: Fake endpoint for testing various parameters
|
Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
description: |
|
||||||
|
Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
operationId: testEndpointParameters
|
operationId: testEndpointParameters
|
||||||
produces:
|
produces:
|
||||||
- application/xml
|
- application/xml
|
||||||
|
2
pom.xml
2
pom.xml
@ -567,7 +567,7 @@
|
|||||||
<commons-cli-version>1.2</commons-cli-version>
|
<commons-cli-version>1.2</commons-cli-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<commons-lang-version>2.4</commons-lang-version>
|
<commons-lang-version>3.4</commons-lang-version>
|
||||||
<slf4j-version>1.7.12</slf4j-version>
|
<slf4j-version>1.7.12</slf4j-version>
|
||||||
<scala-maven-plugin-version>3.2.1</scala-maven-plugin-version>
|
<scala-maven-plugin-version>3.2.1</scala-maven-plugin-version>
|
||||||
<jmustache-version>1.12</jmustache-version>
|
<jmustache-version>1.12</jmustache-version>
|
||||||
|
@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build date: 2016-05-06T10:33:16.765+08:00
|
- Build date: 2016-05-06T16:24:00.420+08:00
|
||||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
@ -88,6 +88,10 @@ 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
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
*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
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
# EnumClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# EnumTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**enum_string** | **string** | | [optional]
|
||||||
|
**enum_integer** | **int** | | [optional]
|
||||||
|
**enum_number** | **double** | | [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)
|
||||||
|
|
||||||
|
|
@ -5,14 +5,26 @@ 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
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# **testEndpointParameters**
|
# **testEndpointParameters**
|
||||||
> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password)
|
> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password)
|
||||||
|
|
||||||
Fake endpoint for testing various parameters
|
Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
|
|
||||||
Fake endpoint for testing various parameters
|
Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```php
|
```php
|
||||||
|
@ -94,6 +94,10 @@ class FakeApi
|
|||||||
* testEndpointParameters
|
* testEndpointParameters
|
||||||
*
|
*
|
||||||
* Fake endpoint for testing various parameters
|
* Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
*
|
*
|
||||||
* @param float $number None (required)
|
* @param float $number None (required)
|
||||||
* @param double $double None (required)
|
* @param double $double None (required)
|
||||||
@ -121,6 +125,10 @@ class FakeApi
|
|||||||
* testEndpointParametersWithHttpInfo
|
* testEndpointParametersWithHttpInfo
|
||||||
*
|
*
|
||||||
* Fake endpoint for testing various parameters
|
* Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
*
|
*
|
||||||
* @param float $number None (required)
|
* @param float $number None (required)
|
||||||
* @param double $double None (required)
|
* @param double $double None (required)
|
||||||
|
@ -0,0 +1,182 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* EnumClass
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Copyright 2016 SmartBear Software
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Swagger\Client\Model;
|
||||||
|
|
||||||
|
use \ArrayAccess;
|
||||||
|
/**
|
||||||
|
* EnumClass Class Doc Comment
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @description
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
class EnumClass implements ArrayAccess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The original name of the model.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
static $swaggerModelName = 'EnumClass';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of property to type mappings. Used for (de)serialization
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $swaggerTypes = array(
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
static function swaggerTypes() {
|
||||||
|
return self::$swaggerTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes where the key is the local name, and the value is the original name
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $attributeMap = array(
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
static function attributeMap() {
|
||||||
|
return self::$attributeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes to setter functions (for deserialization of responses)
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $setters = array(
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
static function setters() {
|
||||||
|
return self::$setters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes to getter functions (for serialization of requests)
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $getters = array(
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
static function getters() {
|
||||||
|
return self::$getters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associative array for storing property values
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
protected $container = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param mixed[] $data Associated array of property value initalizing the model
|
||||||
|
*/
|
||||||
|
public function __construct(array $data = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if ($data != null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns true if offset exists. False otherwise.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
return isset($this->container[$offset]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
return isset($this->container[$offset]) ? $this->container[$offset] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets value based on offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @param mixed $value Value to be set
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
if (is_null($offset)) {
|
||||||
|
$this->container[] = $value;
|
||||||
|
} else {
|
||||||
|
$this->container[$offset] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsets offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
unset($this->container[$offset]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||||
|
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,318 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* EnumTest
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Copyright 2016 SmartBear Software
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Swagger\Client\Model;
|
||||||
|
|
||||||
|
use \ArrayAccess;
|
||||||
|
/**
|
||||||
|
* EnumTest Class Doc Comment
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @description
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
class EnumTest implements ArrayAccess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The original name of the model.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
static $swaggerModelName = 'Enum_Test';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of property to type mappings. Used for (de)serialization
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $swaggerTypes = array(
|
||||||
|
'enum_string' => 'string',
|
||||||
|
'enum_integer' => 'int',
|
||||||
|
'enum_number' => 'double'
|
||||||
|
);
|
||||||
|
|
||||||
|
static function swaggerTypes() {
|
||||||
|
return self::$swaggerTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes where the key is the local name, and the value is the original name
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $attributeMap = array(
|
||||||
|
'enum_string' => 'enum_string',
|
||||||
|
'enum_integer' => 'enum_integer',
|
||||||
|
'enum_number' => 'enum_number'
|
||||||
|
);
|
||||||
|
|
||||||
|
static function attributeMap() {
|
||||||
|
return self::$attributeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes to setter functions (for deserialization of responses)
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $setters = array(
|
||||||
|
'enum_string' => 'setEnumString',
|
||||||
|
'enum_integer' => 'setEnumInteger',
|
||||||
|
'enum_number' => 'setEnumNumber'
|
||||||
|
);
|
||||||
|
|
||||||
|
static function setters() {
|
||||||
|
return self::$setters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes to getter functions (for serialization of requests)
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $getters = array(
|
||||||
|
'enum_string' => 'getEnumString',
|
||||||
|
'enum_integer' => 'getEnumInteger',
|
||||||
|
'enum_number' => 'getEnumNumber'
|
||||||
|
);
|
||||||
|
|
||||||
|
static function getters() {
|
||||||
|
return self::$getters;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ENUM_STRING_UPPER = 'UPPER';
|
||||||
|
const ENUM_STRING_LOWER = 'lower';
|
||||||
|
const ENUM_INTEGER_1 = 1;
|
||||||
|
const ENUM_INTEGER_MINUS_1 = -1;
|
||||||
|
const ENUM_NUMBER_1_DOT_1 = 1.1;
|
||||||
|
const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets allowable values of the enum
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getEnumStringAllowableValues() {
|
||||||
|
return [
|
||||||
|
self::ENUM_STRING_UPPER,
|
||||||
|
self::ENUM_STRING_LOWER,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets allowable values of the enum
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getEnumIntegerAllowableValues() {
|
||||||
|
return [
|
||||||
|
self::ENUM_INTEGER_1,
|
||||||
|
self::ENUM_INTEGER_MINUS_1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets allowable values of the enum
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getEnumNumberAllowableValues() {
|
||||||
|
return [
|
||||||
|
self::ENUM_NUMBER_1_DOT_1,
|
||||||
|
self::ENUM_NUMBER_MINUS_1_DOT_2,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associative array for storing property values
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
protected $container = array(
|
||||||
|
/**
|
||||||
|
* $container['enum_string']
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
'enum_string' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $container['enum_integer']
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
'enum_integer' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $container['enum_number']
|
||||||
|
* @var double
|
||||||
|
*/
|
||||||
|
'enum_number' => null,
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param mixed[] $data Associated array of property value initalizing the model
|
||||||
|
*/
|
||||||
|
public function __construct(array $data = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if ($data != null) {
|
||||||
|
$this->container['enum_string'] = $data['enum_string'];
|
||||||
|
$this->container['enum_integer'] = $data['enum_integer'];
|
||||||
|
$this->container['enum_number'] = $data['enum_number'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets enum_string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEnumString()
|
||||||
|
{
|
||||||
|
return $this->container['enum_string'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets enum_string
|
||||||
|
* @param string $enum_string
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setEnumString($enum_string)
|
||||||
|
{
|
||||||
|
$allowed_values = array('UPPER', 'lower');
|
||||||
|
if (!in_array($enum_string, $allowed_values)) {
|
||||||
|
throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'");
|
||||||
|
}
|
||||||
|
$this->container['enum_string'] = $enum_string;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets enum_integer
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getEnumInteger()
|
||||||
|
{
|
||||||
|
return $this->container['enum_integer'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets enum_integer
|
||||||
|
* @param int $enum_integer
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setEnumInteger($enum_integer)
|
||||||
|
{
|
||||||
|
$allowed_values = array('1', '-1');
|
||||||
|
if (!in_array($enum_integer, $allowed_values)) {
|
||||||
|
throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'");
|
||||||
|
}
|
||||||
|
$this->container['enum_integer'] = $enum_integer;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets enum_number
|
||||||
|
* @return double
|
||||||
|
*/
|
||||||
|
public function getEnumNumber()
|
||||||
|
{
|
||||||
|
return $this->container['enum_number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets enum_number
|
||||||
|
* @param double $enum_number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setEnumNumber($enum_number)
|
||||||
|
{
|
||||||
|
$allowed_values = array('1.1', '-1.2');
|
||||||
|
if (!in_array($enum_number, $allowed_values)) {
|
||||||
|
throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'");
|
||||||
|
}
|
||||||
|
$this->container['enum_number'] = $enum_number;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns true if offset exists. False otherwise.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
return isset($this->container[$offset]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
return isset($this->container[$offset]) ? $this->container[$offset] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets value based on offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @param mixed $value Value to be set
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
if (is_null($offset)) {
|
||||||
|
$this->container[] = $value;
|
||||||
|
} else {
|
||||||
|
$this->container[$offset] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsets offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
unset($this->container[$offset]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||||
|
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* EnumClassTest
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Copyright 2016 SmartBear Software
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Please update the test case below to test the model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Swagger\Client\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EnumClassTest Class Doc Comment
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @description
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
class EnumClassTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup before running each test case
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up after running each test case
|
||||||
|
*/
|
||||||
|
public static function tearDownAfterClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test EnumClass
|
||||||
|
*/
|
||||||
|
public function testEnumClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* EnumTestTest
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Copyright 2016 SmartBear Software
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Please update the test case below to test the model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Swagger\Client\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EnumTestTest Class Doc Comment
|
||||||
|
*
|
||||||
|
* @category Class
|
||||||
|
* @description
|
||||||
|
* @package Swagger\Client
|
||||||
|
* @author http://github.com/swagger-api/swagger-codegen
|
||||||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||||
|
* @link https://github.com/swagger-api/swagger-codegen
|
||||||
|
*/
|
||||||
|
class EnumTestTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup before running each test case
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up after running each test case
|
||||||
|
*/
|
||||||
|
public static function tearDownAfterClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test EnumTest
|
||||||
|
*/
|
||||||
|
public function testEnumTest() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -68,6 +68,10 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
* Test case for testEndpointParameters
|
* Test case for testEndpointParameters
|
||||||
*
|
*
|
||||||
* Fake endpoint for testing various parameters
|
* Fake endpoint for testing various parameters
|
||||||
|
假端點
|
||||||
|
偽のエンドポイント
|
||||||
|
가짜 엔드 포인트
|
||||||
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function test_testEndpointParameters() {
|
public function test_testEndpointParameters() {
|
||||||
|
@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build date: 2016-05-02T21:47:16.723+08:00
|
- Build date: 2016-05-06T16:33:11.754+08:00
|
||||||
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@ -77,7 +77,7 @@ opts = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
#Fake endpoint for testing various parameters
|
#Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
|
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
|
||||||
rescue Petstore::ApiError => e
|
rescue Petstore::ApiError => e
|
||||||
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
|
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
|
||||||
@ -91,7 +91,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters
|
*Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||||
*Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
*Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||||
*Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
*Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||||
@ -117,10 +117,13 @@ Class | Method | HTTP request | Description
|
|||||||
## Documentation for Models
|
## Documentation for Models
|
||||||
|
|
||||||
- [Petstore::Animal](docs/Animal.md)
|
- [Petstore::Animal](docs/Animal.md)
|
||||||
|
- [Petstore::AnimalFarm](docs/AnimalFarm.md)
|
||||||
- [Petstore::ApiResponse](docs/ApiResponse.md)
|
- [Petstore::ApiResponse](docs/ApiResponse.md)
|
||||||
- [Petstore::Cat](docs/Cat.md)
|
- [Petstore::Cat](docs/Cat.md)
|
||||||
- [Petstore::Category](docs/Category.md)
|
- [Petstore::Category](docs/Category.md)
|
||||||
- [Petstore::Dog](docs/Dog.md)
|
- [Petstore::Dog](docs/Dog.md)
|
||||||
|
- [Petstore::EnumClass](docs/EnumClass.md)
|
||||||
|
- [Petstore::EnumTest](docs/EnumTest.md)
|
||||||
- [Petstore::FormatTest](docs/FormatTest.md)
|
- [Petstore::FormatTest](docs/FormatTest.md)
|
||||||
- [Petstore::Model200Response](docs/Model200Response.md)
|
- [Petstore::Model200Response](docs/Model200Response.md)
|
||||||
- [Petstore::ModelReturn](docs/ModelReturn.md)
|
- [Petstore::ModelReturn](docs/ModelReturn.md)
|
||||||
|
7
samples/client/petstore/ruby/docs/AnimalFarm.md
Normal file
7
samples/client/petstore/ruby/docs/AnimalFarm.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Petstore::AnimalFarm
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
7
samples/client/petstore/ruby/docs/EnumClass.md
Normal file
7
samples/client/petstore/ruby/docs/EnumClass.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Petstore::EnumClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
10
samples/client/petstore/ruby/docs/EnumTest.md
Normal file
10
samples/client/petstore/ruby/docs/EnumTest.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Petstore::EnumTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**enum_string** | **String** | | [optional]
|
||||||
|
**enum_integer** | **Integer** | | [optional]
|
||||||
|
**enum_number** | **Float** | | [optional]
|
||||||
|
|
||||||
|
|
@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters
|
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
|
||||||
|
|
||||||
# **test_endpoint_parameters**
|
# **test_endpoint_parameters**
|
||||||
> test_endpoint_parameters(number, double, string, byte, opts)
|
> test_endpoint_parameters(number, double, string, byte, opts)
|
||||||
|
|
||||||
Fake endpoint for testing various parameters
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
|
||||||
Fake endpoint for testing various parameters
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```ruby
|
```ruby
|
||||||
@ -41,7 +41,7 @@ opts = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
#Fake endpoint for testing various parameters
|
#Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
|
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
|
||||||
rescue Petstore::ApiError => e
|
rescue Petstore::ApiError => e
|
||||||
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
|
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
|
||||||
|
@ -22,10 +22,13 @@ require 'petstore/configuration'
|
|||||||
|
|
||||||
# Models
|
# Models
|
||||||
require 'petstore/models/animal'
|
require 'petstore/models/animal'
|
||||||
|
require 'petstore/models/animal_farm'
|
||||||
require 'petstore/models/api_response'
|
require 'petstore/models/api_response'
|
||||||
require 'petstore/models/cat'
|
require 'petstore/models/cat'
|
||||||
require 'petstore/models/category'
|
require 'petstore/models/category'
|
||||||
require 'petstore/models/dog'
|
require 'petstore/models/dog'
|
||||||
|
require 'petstore/models/enum_class'
|
||||||
|
require 'petstore/models/enum_test'
|
||||||
require 'petstore/models/format_test'
|
require 'petstore/models/format_test'
|
||||||
require 'petstore/models/model_200_response'
|
require 'petstore/models/model_200_response'
|
||||||
require 'petstore/models/model_return'
|
require 'petstore/models/model_return'
|
||||||
|
@ -24,8 +24,8 @@ module Petstore
|
|||||||
@api_client = api_client
|
@api_client = api_client
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fake endpoint for testing various parameters
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
# Fake endpoint for testing various parameters
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
# @param number None
|
# @param number None
|
||||||
# @param double None
|
# @param double None
|
||||||
# @param string None
|
# @param string None
|
||||||
@ -45,8 +45,8 @@ module Petstore
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fake endpoint for testing various parameters
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
# Fake endpoint for testing various parameters
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
# @param number None
|
# @param number None
|
||||||
# @param double None
|
# @param double None
|
||||||
# @param string None
|
# @param string None
|
||||||
|
179
samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb
Normal file
179
samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
=begin
|
||||||
|
Swagger Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||||
|
|
||||||
|
OpenAPI spec version: 1.0.0
|
||||||
|
Contact: apiteam@swagger.io
|
||||||
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
|
||||||
|
License: Apache 2.0
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
Terms of Service: http://swagger.io/terms/
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
module Petstore
|
||||||
|
class AnimalFarm
|
||||||
|
# Attribute mapping from ruby-style variable name to JSON key.
|
||||||
|
def self.attribute_map
|
||||||
|
{
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Attribute type mapping.
|
||||||
|
def self.swagger_types
|
||||||
|
{
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Initializes the object
|
||||||
|
# @param [Hash] attributes Model attributes in the form of hash
|
||||||
|
def initialize(attributes = {})
|
||||||
|
return unless attributes.is_a?(Hash)
|
||||||
|
|
||||||
|
# convert string to symbol for hash key
|
||||||
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Show invalid properties with the reasons. Usually used together with valid?
|
||||||
|
# @return Array for valid properies with the reasons
|
||||||
|
def list_invalid_properties
|
||||||
|
invalid_properties = Array.new
|
||||||
|
return invalid_properties
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check to see if the all the properties in the model are valid
|
||||||
|
# @return true if the model is valid
|
||||||
|
def valid?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Checks equality by comparing each attribute.
|
||||||
|
# @param [Object] Object to be compared
|
||||||
|
def ==(o)
|
||||||
|
return true if self.equal?(o)
|
||||||
|
self.class == o.class
|
||||||
|
end
|
||||||
|
|
||||||
|
# @see the `==` method
|
||||||
|
# @param [Object] Object to be compared
|
||||||
|
def eql?(o)
|
||||||
|
self == o
|
||||||
|
end
|
||||||
|
|
||||||
|
# Calculates hash code according to all attributes.
|
||||||
|
# @return [Fixnum] Hash code
|
||||||
|
def hash
|
||||||
|
[].hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Builds the object from hash
|
||||||
|
# @param [Hash] attributes Model attributes in the form of hash
|
||||||
|
# @return [Object] Returns the model itself
|
||||||
|
def build_from_hash(attributes)
|
||||||
|
return nil unless attributes.is_a?(Hash)
|
||||||
|
self.class.swagger_types.each_pair do |key, type|
|
||||||
|
if type =~ /^Array<(.*)>/i
|
||||||
|
# check to ensure the input is an array given that the the attribute
|
||||||
|
# is documented as an array but the input is not
|
||||||
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
||||||
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
||||||
|
end
|
||||||
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||||
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||||
|
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
||||||
|
end
|
||||||
|
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deserializes the data based on type
|
||||||
|
# @param string type Data type
|
||||||
|
# @param string value Value to be deserialized
|
||||||
|
# @return [Object] Deserialized data
|
||||||
|
def _deserialize(type, value)
|
||||||
|
case type.to_sym
|
||||||
|
when :DateTime
|
||||||
|
DateTime.parse(value)
|
||||||
|
when :Date
|
||||||
|
Date.parse(value)
|
||||||
|
when :String
|
||||||
|
value.to_s
|
||||||
|
when :Integer
|
||||||
|
value.to_i
|
||||||
|
when :Float
|
||||||
|
value.to_f
|
||||||
|
when :BOOLEAN
|
||||||
|
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
when :Object
|
||||||
|
# generic object (usually a Hash), return directly
|
||||||
|
value
|
||||||
|
when /\AArray<(?<inner_type>.+)>\z/
|
||||||
|
inner_type = Regexp.last_match[:inner_type]
|
||||||
|
value.map { |v| _deserialize(inner_type, v) }
|
||||||
|
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
||||||
|
k_type = Regexp.last_match[:k_type]
|
||||||
|
v_type = Regexp.last_match[:v_type]
|
||||||
|
{}.tap do |hash|
|
||||||
|
value.each do |k, v|
|
||||||
|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else # model
|
||||||
|
temp_model = Petstore.const_get(type).new
|
||||||
|
temp_model.build_from_hash(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the string representation of the object
|
||||||
|
# @return [String] String presentation of the object
|
||||||
|
def to_s
|
||||||
|
to_hash.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
# to_body is an alias to to_hash (backward compatibility)
|
||||||
|
# @return [Hash] Returns the object in the form of hash
|
||||||
|
def to_body
|
||||||
|
to_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the object in the form of hash
|
||||||
|
# @return [Hash] Returns the object in the form of hash
|
||||||
|
def to_hash
|
||||||
|
hash = {}
|
||||||
|
self.class.attribute_map.each_pair do |attr, param|
|
||||||
|
value = self.send(attr)
|
||||||
|
next if value.nil?
|
||||||
|
hash[param] = _to_hash(value)
|
||||||
|
end
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Outputs non-array value in the form of hash
|
||||||
|
# For object, use to_hash. Otherwise, just return the value
|
||||||
|
# @param [Object] value Any valid value
|
||||||
|
# @return [Hash] Returns the value in the form of hash
|
||||||
|
def _to_hash(value)
|
||||||
|
if value.is_a?(Array)
|
||||||
|
value.compact.map{ |v| _to_hash(v) }
|
||||||
|
elsif value.is_a?(Hash)
|
||||||
|
{}.tap do |hash|
|
||||||
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||||
|
end
|
||||||
|
elsif value.respond_to? :to_hash
|
||||||
|
value.to_hash
|
||||||
|
else
|
||||||
|
value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
184
samples/client/petstore/ruby/lib/petstore/models/enum_class.rb
Normal file
184
samples/client/petstore/ruby/lib/petstore/models/enum_class.rb
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
=begin
|
||||||
|
Swagger Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||||
|
|
||||||
|
OpenAPI spec version: 1.0.0
|
||||||
|
Contact: apiteam@swagger.io
|
||||||
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
|
||||||
|
License: Apache 2.0
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
Terms of Service: http://swagger.io/terms/
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
module Petstore
|
||||||
|
class EnumClass
|
||||||
|
# Attribute mapping from ruby-style variable name to JSON key.
|
||||||
|
def self.attribute_map
|
||||||
|
{
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Attribute type mapping.
|
||||||
|
def self.swagger_types
|
||||||
|
{
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Initializes the object
|
||||||
|
# @param [Hash] attributes Model attributes in the form of hash
|
||||||
|
def initialize(attributes = {})
|
||||||
|
return unless attributes.is_a?(Hash)
|
||||||
|
|
||||||
|
# convert string to symbol for hash key
|
||||||
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Show invalid properties with the reasons. Usually used together with valid?
|
||||||
|
# @return Array for valid properies with the reasons
|
||||||
|
def list_invalid_properties
|
||||||
|
invalid_properties = Array.new
|
||||||
|
allowed_values = ["_abc", "-efg", "(xyz)"]
|
||||||
|
if @EnumClass && !allowed_values.include?(EnumClass)
|
||||||
|
invalid_properties.push("invalid value for 'EnumClass', must be one of #{allowed_values}.")
|
||||||
|
end
|
||||||
|
|
||||||
|
return invalid_properties
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check to see if the all the properties in the model are valid
|
||||||
|
# @return true if the model is valid
|
||||||
|
def valid?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Checks equality by comparing each attribute.
|
||||||
|
# @param [Object] Object to be compared
|
||||||
|
def ==(o)
|
||||||
|
return true if self.equal?(o)
|
||||||
|
self.class == o.class
|
||||||
|
end
|
||||||
|
|
||||||
|
# @see the `==` method
|
||||||
|
# @param [Object] Object to be compared
|
||||||
|
def eql?(o)
|
||||||
|
self == o
|
||||||
|
end
|
||||||
|
|
||||||
|
# Calculates hash code according to all attributes.
|
||||||
|
# @return [Fixnum] Hash code
|
||||||
|
def hash
|
||||||
|
[].hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Builds the object from hash
|
||||||
|
# @param [Hash] attributes Model attributes in the form of hash
|
||||||
|
# @return [Object] Returns the model itself
|
||||||
|
def build_from_hash(attributes)
|
||||||
|
return nil unless attributes.is_a?(Hash)
|
||||||
|
self.class.swagger_types.each_pair do |key, type|
|
||||||
|
if type =~ /^Array<(.*)>/i
|
||||||
|
# check to ensure the input is an array given that the the attribute
|
||||||
|
# is documented as an array but the input is not
|
||||||
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
||||||
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
||||||
|
end
|
||||||
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||||
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||||
|
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
||||||
|
end
|
||||||
|
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deserializes the data based on type
|
||||||
|
# @param string type Data type
|
||||||
|
# @param string value Value to be deserialized
|
||||||
|
# @return [Object] Deserialized data
|
||||||
|
def _deserialize(type, value)
|
||||||
|
case type.to_sym
|
||||||
|
when :DateTime
|
||||||
|
DateTime.parse(value)
|
||||||
|
when :Date
|
||||||
|
Date.parse(value)
|
||||||
|
when :String
|
||||||
|
value.to_s
|
||||||
|
when :Integer
|
||||||
|
value.to_i
|
||||||
|
when :Float
|
||||||
|
value.to_f
|
||||||
|
when :BOOLEAN
|
||||||
|
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
when :Object
|
||||||
|
# generic object (usually a Hash), return directly
|
||||||
|
value
|
||||||
|
when /\AArray<(?<inner_type>.+)>\z/
|
||||||
|
inner_type = Regexp.last_match[:inner_type]
|
||||||
|
value.map { |v| _deserialize(inner_type, v) }
|
||||||
|
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
||||||
|
k_type = Regexp.last_match[:k_type]
|
||||||
|
v_type = Regexp.last_match[:v_type]
|
||||||
|
{}.tap do |hash|
|
||||||
|
value.each do |k, v|
|
||||||
|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else # model
|
||||||
|
temp_model = Petstore.const_get(type).new
|
||||||
|
temp_model.build_from_hash(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the string representation of the object
|
||||||
|
# @return [String] String presentation of the object
|
||||||
|
def to_s
|
||||||
|
to_hash.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
# to_body is an alias to to_hash (backward compatibility)
|
||||||
|
# @return [Hash] Returns the object in the form of hash
|
||||||
|
def to_body
|
||||||
|
to_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the object in the form of hash
|
||||||
|
# @return [Hash] Returns the object in the form of hash
|
||||||
|
def to_hash
|
||||||
|
hash = {}
|
||||||
|
self.class.attribute_map.each_pair do |attr, param|
|
||||||
|
value = self.send(attr)
|
||||||
|
next if value.nil?
|
||||||
|
hash[param] = _to_hash(value)
|
||||||
|
end
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Outputs non-array value in the form of hash
|
||||||
|
# For object, use to_hash. Otherwise, just return the value
|
||||||
|
# @param [Object] value Any valid value
|
||||||
|
# @return [Hash] Returns the value in the form of hash
|
||||||
|
def _to_hash(value)
|
||||||
|
if value.is_a?(Array)
|
||||||
|
value.compact.map{ |v| _to_hash(v) }
|
||||||
|
elsif value.is_a?(Hash)
|
||||||
|
{}.tap do |hash|
|
||||||
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||||
|
end
|
||||||
|
elsif value.respond_to? :to_hash
|
||||||
|
value.to_hash
|
||||||
|
else
|
||||||
|
value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
248
samples/client/petstore/ruby/lib/petstore/models/enum_test.rb
Normal file
248
samples/client/petstore/ruby/lib/petstore/models/enum_test.rb
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
=begin
|
||||||
|
Swagger Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||||
|
|
||||||
|
OpenAPI spec version: 1.0.0
|
||||||
|
Contact: apiteam@swagger.io
|
||||||
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
|
||||||
|
License: Apache 2.0
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
Terms of Service: http://swagger.io/terms/
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
module Petstore
|
||||||
|
class EnumTest
|
||||||
|
attr_accessor :enum_string
|
||||||
|
|
||||||
|
attr_accessor :enum_integer
|
||||||
|
|
||||||
|
attr_accessor :enum_number
|
||||||
|
|
||||||
|
# Attribute mapping from ruby-style variable name to JSON key.
|
||||||
|
def self.attribute_map
|
||||||
|
{
|
||||||
|
:'enum_string' => :'enum_string',
|
||||||
|
:'enum_integer' => :'enum_integer',
|
||||||
|
:'enum_number' => :'enum_number'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Attribute type mapping.
|
||||||
|
def self.swagger_types
|
||||||
|
{
|
||||||
|
:'enum_string' => :'String',
|
||||||
|
:'enum_integer' => :'Integer',
|
||||||
|
:'enum_number' => :'Float'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Initializes the object
|
||||||
|
# @param [Hash] attributes Model attributes in the form of hash
|
||||||
|
def initialize(attributes = {})
|
||||||
|
return unless attributes.is_a?(Hash)
|
||||||
|
|
||||||
|
# convert string to symbol for hash key
|
||||||
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
||||||
|
|
||||||
|
if attributes.has_key?(:'enum_string')
|
||||||
|
self.enum_string = attributes[:'enum_string']
|
||||||
|
end
|
||||||
|
|
||||||
|
if attributes.has_key?(:'enum_integer')
|
||||||
|
self.enum_integer = attributes[:'enum_integer']
|
||||||
|
end
|
||||||
|
|
||||||
|
if attributes.has_key?(:'enum_number')
|
||||||
|
self.enum_number = attributes[:'enum_number']
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Show invalid properties with the reasons. Usually used together with valid?
|
||||||
|
# @return Array for valid properies with the reasons
|
||||||
|
def list_invalid_properties
|
||||||
|
invalid_properties = Array.new
|
||||||
|
return invalid_properties
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check to see if the all the properties in the model are valid
|
||||||
|
# @return true if the model is valid
|
||||||
|
def valid?
|
||||||
|
allowed_values = ["UPPER", "lower"]
|
||||||
|
if @enum_string && !allowed_values.include?(@enum_string)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
allowed_values = ["1", "-1"]
|
||||||
|
if @enum_integer && !allowed_values.include?(@enum_integer)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
allowed_values = ["1.1", "-1.2"]
|
||||||
|
if @enum_number && !allowed_values.include?(@enum_number)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Custom attribute writer method checking allowed values (enum).
|
||||||
|
# @param [Object] enum_string Object to be assigned
|
||||||
|
def enum_string=(enum_string)
|
||||||
|
allowed_values = ["UPPER", "lower"]
|
||||||
|
if enum_string && !allowed_values.include?(enum_string)
|
||||||
|
fail ArgumentError, "invalid value for 'enum_string', must be one of #{allowed_values}."
|
||||||
|
end
|
||||||
|
@enum_string = enum_string
|
||||||
|
end
|
||||||
|
|
||||||
|
# Custom attribute writer method checking allowed values (enum).
|
||||||
|
# @param [Object] enum_integer Object to be assigned
|
||||||
|
def enum_integer=(enum_integer)
|
||||||
|
allowed_values = ["1", "-1"]
|
||||||
|
if enum_integer && !allowed_values.include?(enum_integer)
|
||||||
|
fail ArgumentError, "invalid value for 'enum_integer', must be one of #{allowed_values}."
|
||||||
|
end
|
||||||
|
@enum_integer = enum_integer
|
||||||
|
end
|
||||||
|
|
||||||
|
# Custom attribute writer method checking allowed values (enum).
|
||||||
|
# @param [Object] enum_number Object to be assigned
|
||||||
|
def enum_number=(enum_number)
|
||||||
|
allowed_values = ["1.1", "-1.2"]
|
||||||
|
if enum_number && !allowed_values.include?(enum_number)
|
||||||
|
fail ArgumentError, "invalid value for 'enum_number', must be one of #{allowed_values}."
|
||||||
|
end
|
||||||
|
@enum_number = enum_number
|
||||||
|
end
|
||||||
|
|
||||||
|
# Checks equality by comparing each attribute.
|
||||||
|
# @param [Object] Object to be compared
|
||||||
|
def ==(o)
|
||||||
|
return true if self.equal?(o)
|
||||||
|
self.class == o.class &&
|
||||||
|
enum_string == o.enum_string &&
|
||||||
|
enum_integer == o.enum_integer &&
|
||||||
|
enum_number == o.enum_number
|
||||||
|
end
|
||||||
|
|
||||||
|
# @see the `==` method
|
||||||
|
# @param [Object] Object to be compared
|
||||||
|
def eql?(o)
|
||||||
|
self == o
|
||||||
|
end
|
||||||
|
|
||||||
|
# Calculates hash code according to all attributes.
|
||||||
|
# @return [Fixnum] Hash code
|
||||||
|
def hash
|
||||||
|
[enum_string, enum_integer, enum_number].hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Builds the object from hash
|
||||||
|
# @param [Hash] attributes Model attributes in the form of hash
|
||||||
|
# @return [Object] Returns the model itself
|
||||||
|
def build_from_hash(attributes)
|
||||||
|
return nil unless attributes.is_a?(Hash)
|
||||||
|
self.class.swagger_types.each_pair do |key, type|
|
||||||
|
if type =~ /^Array<(.*)>/i
|
||||||
|
# check to ensure the input is an array given that the the attribute
|
||||||
|
# is documented as an array but the input is not
|
||||||
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
||||||
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
||||||
|
end
|
||||||
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||||
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||||
|
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
||||||
|
end
|
||||||
|
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deserializes the data based on type
|
||||||
|
# @param string type Data type
|
||||||
|
# @param string value Value to be deserialized
|
||||||
|
# @return [Object] Deserialized data
|
||||||
|
def _deserialize(type, value)
|
||||||
|
case type.to_sym
|
||||||
|
when :DateTime
|
||||||
|
DateTime.parse(value)
|
||||||
|
when :Date
|
||||||
|
Date.parse(value)
|
||||||
|
when :String
|
||||||
|
value.to_s
|
||||||
|
when :Integer
|
||||||
|
value.to_i
|
||||||
|
when :Float
|
||||||
|
value.to_f
|
||||||
|
when :BOOLEAN
|
||||||
|
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
when :Object
|
||||||
|
# generic object (usually a Hash), return directly
|
||||||
|
value
|
||||||
|
when /\AArray<(?<inner_type>.+)>\z/
|
||||||
|
inner_type = Regexp.last_match[:inner_type]
|
||||||
|
value.map { |v| _deserialize(inner_type, v) }
|
||||||
|
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
||||||
|
k_type = Regexp.last_match[:k_type]
|
||||||
|
v_type = Regexp.last_match[:v_type]
|
||||||
|
{}.tap do |hash|
|
||||||
|
value.each do |k, v|
|
||||||
|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else # model
|
||||||
|
temp_model = Petstore.const_get(type).new
|
||||||
|
temp_model.build_from_hash(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the string representation of the object
|
||||||
|
# @return [String] String presentation of the object
|
||||||
|
def to_s
|
||||||
|
to_hash.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
# to_body is an alias to to_hash (backward compatibility)
|
||||||
|
# @return [Hash] Returns the object in the form of hash
|
||||||
|
def to_body
|
||||||
|
to_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the object in the form of hash
|
||||||
|
# @return [Hash] Returns the object in the form of hash
|
||||||
|
def to_hash
|
||||||
|
hash = {}
|
||||||
|
self.class.attribute_map.each_pair do |attr, param|
|
||||||
|
value = self.send(attr)
|
||||||
|
next if value.nil?
|
||||||
|
hash[param] = _to_hash(value)
|
||||||
|
end
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Outputs non-array value in the form of hash
|
||||||
|
# For object, use to_hash. Otherwise, just return the value
|
||||||
|
# @param [Object] value Any valid value
|
||||||
|
# @return [Hash] Returns the value in the form of hash
|
||||||
|
def _to_hash(value)
|
||||||
|
if value.is_a?(Array)
|
||||||
|
value.compact.map{ |v| _to_hash(v) }
|
||||||
|
elsif value.is_a?(Hash)
|
||||||
|
{}.tap do |hash|
|
||||||
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||||
|
end
|
||||||
|
elsif value.respond_to? :to_hash
|
||||||
|
value.to_hash
|
||||||
|
else
|
||||||
|
value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user