diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml
index afaecfc3512..9ea75ad3c88 100644
--- a/modules/swagger-codegen/pom.xml
+++ b/modules/swagger-codegen/pom.xml
@@ -252,8 +252,8 @@
${slf4j-version}
- commons-lang
- commons-lang
+ org.apache.commons
+ commons-lang3
${commons-lang-version}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
index db000e9c63e..f350339127b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
@@ -9,8 +9,8 @@ import io.swagger.models.parameters.*;
import io.swagger.models.properties.*;
import io.swagger.models.properties.PropertyBuilder.PropertyId;
import io.swagger.util.Json;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -325,7 +325,7 @@ public class DefaultCodegen {
@SuppressWarnings("static-method")
public String escapeText(String input) {
if (input != null) {
- return StringEscapeUtils.escapeJava(input).replace("\\/", "/");
+ return StringEscapeUtils.unescapeJava(StringEscapeUtils.escapeJava(input).replace("\\/", "/")).replaceAll("[\\t\\n\\r]"," ");
}
return input;
}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java
index e9d6457f6f0..0058468efc8 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java
@@ -2,7 +2,7 @@ package io.swagger.codegen.languages;
import io.swagger.codegen.*;
import io.swagger.models.properties.*;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java
index 55c1df5438c..9e30ae657c8 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java
@@ -6,7 +6,7 @@ import io.swagger.models.properties.*;
import java.util.*;
import java.io.File;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java
index 523fa6ae8c6..43faca235d0 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java
@@ -26,7 +26,7 @@ import io.swagger.models.properties.LongProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
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.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
index c0bead5c695..bed84f855bf 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
@@ -14,7 +14,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java
index cf8915974e6..90bea4a8a6b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java
@@ -2,7 +2,7 @@ package io.swagger.codegen.languages;
import io.swagger.codegen.*;
import io.swagger.models.properties.*;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
index 1212795e1bb..5780466ddbc 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
@@ -25,8 +25,8 @@ import java.util.Map;
import java.util.ArrayList;
import java.util.Iterator;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.WordUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.WordUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java
index 2c60a30754b..73ef83bc9cc 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java
@@ -11,7 +11,7 @@ import io.swagger.models.Contact;
import io.swagger.models.Info;
import io.swagger.models.License;
import io.swagger.models.Swagger;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.Map;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java
index b5699a93a34..a9eb1a97de7 100755
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java
@@ -17,7 +17,7 @@ import io.swagger.models.properties.LongProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.StringProperty;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.Arrays;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java
index fe25436c901..4e34424eab7 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java
@@ -9,7 +9,7 @@ import io.swagger.models.parameters.Parameter;
import java.io.File;
import java.util.*;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -450,4 +450,4 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
public void setPackageVersion(String packageVersion) {
this.packageVersion = packageVersion;
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java
index 903cb7ba76e..2d08c9741e9 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java
@@ -183,4 +183,4 @@ public class JMeterCodegen extends DefaultCodegen implements CodegenConfig {
type = swaggerType;
return toModelName(type);
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
index e607670313c..bc839f07d18 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
@@ -9,9 +9,9 @@ import io.swagger.models.Swagger;
import io.swagger.models.parameters.FormParameter;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.*;
-import org.apache.commons.lang.BooleanUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.WordUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+//import org.apache.commons.lang3.WordUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java
index 5f715a43621..b919430035d 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java
@@ -4,7 +4,7 @@ import io.swagger.codegen.*;
import io.swagger.models.Operation;
import io.swagger.models.Path;
import io.swagger.models.Swagger;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.*;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java
index feec76d8de2..41f55a50c2b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java
@@ -33,7 +33,7 @@ import io.swagger.models.properties.Property;
import io.swagger.models.properties.RefProperty;
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.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java
index 2a2dfd86c9d..55c3fab96b0 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java
@@ -8,7 +8,7 @@ import java.util.TreeSet;
import java.util.*;
import java.io.File;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig {
public JavascriptClosureAngularClientCodegen() {
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java
index 55e72f79384..fbd98c034df 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java
@@ -232,4 +232,4 @@ public class LumenServerCodegen extends DefaultCodegen implements CodegenConfig
type = swaggerType;
return toModelName(type);
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java
index 21e319f6ec9..44ab79ddcc4 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java
@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
public static final String CLASS_PREFIX = "classPrefix";
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java
index e4744bf037c..e17084a3bc5 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java
@@ -27,7 +27,7 @@ import java.util.Arrays;
import java.util.HashSet;
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 static final String MODULE_NAME = "moduleName";
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java
index 1bc95cfdd67..1c057834ecf 100755
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java
@@ -13,7 +13,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String packageName;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java
index f9c0990c182..aeb8e524e9d 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java
@@ -19,7 +19,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java
index a13c7a54e70..992693810da 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java
@@ -26,7 +26,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "io.swagger.client";
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java
index bb7706b13fe..fb3ceab7d78 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java
@@ -17,7 +17,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java
index 3ff35f170fd..c64fcfb04ef 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java
@@ -85,4 +85,4 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
public String modelFileFolder() {
return outputFolder + File.separator + sourceFolder + File.separator + "models";
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java
index 65ec8529930..0db05d5bc0a 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java
@@ -101,4 +101,4 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
}
return objs;
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java
index b34e6bba5ab..6282f72d8b7 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java
@@ -52,4 +52,4 @@ public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
LOGGER.error(e.getMessage(), e);
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java
index 5442000280f..48f0197068b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java
@@ -51,4 +51,4 @@ public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfi
LOGGER.error(e.getMessage(), e);
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
index 7b6bf8fbdc3..ba846857cb9 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
@@ -13,9 +13,9 @@ import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.WordUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.WordUtils;
import javax.annotation.Nullable;
import java.util.*;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java
index c3f6d7ab99a..ec58781ab2b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java
@@ -25,7 +25,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public class TizenClientCodegen extends DefaultCodegen implements CodegenConfig {
protected static String PREFIX = "Sami";
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java
index ad84f8ca0c7..0ba3d9e2fee 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java
@@ -12,7 +12,7 @@ import java.util.Set;
import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.junit.rules.TemporaryFolder;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
index 068fb8054d8..92e9cb251b1 100644
--- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
+++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -564,8 +564,16 @@ paths:
post:
tags:
- fake
- summary: Fake endpoint for testing various parameters
- description: Fake endpoint for testing various parameters
+ summary: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ description: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
operationId: testEndpointParameters
produces:
- application/xml
diff --git a/pom.xml b/pom.xml
index 9ac1890ea91..1b5c3d7580f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -567,7 +567,7 @@
1.2
4.8.1
1.0.0
- 2.4
+ 3.4
1.7.12
3.2.1
1.12
diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md
index a5cba5dcbb7..ab81085c3ad 100644
--- a/samples/client/petstore/php/SwaggerClient-php/README.md
+++ b/samples/client/petstore/php/SwaggerClient-php/README.md
@@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
- API 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
## Requirements
@@ -88,6 +88,10 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters
+假端點
+偽のエンドポイント
+가짜 엔드 포인트
+
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md
new file mode 100644
index 00000000000..67f017becd0
--- /dev/null
+++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md
@@ -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)
+
+
diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md
new file mode 100644
index 00000000000..2ef9e6adaac
--- /dev/null
+++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.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)
+
+
diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md
index 93c24ef7eeb..4acf36fa696 100644
--- a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md
+++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md
@@ -5,14 +5,26 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters
+假端點
+偽のエンドポイント
+가짜 엔드 포인트
+
# **testEndpointParameters**
> 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
+假端點
+偽のエンドポイント
+가짜 엔드 포인트
+
### Example
```php
diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
index 376572544de..32acfa9e203 100644
--- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
+++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
@@ -94,6 +94,10 @@ class FakeApi
* testEndpointParameters
*
* Fake endpoint for testing various parameters
+假端點
+偽のエンドポイント
+가짜 엔드 포인트
+
*
* @param float $number None (required)
* @param double $double None (required)
@@ -121,6 +125,10 @@ class FakeApi
* testEndpointParametersWithHttpInfo
*
* Fake endpoint for testing various parameters
+假端點
+偽のエンドポイント
+가짜 엔드 포인트
+
*
* @param float $number None (required)
* @param double $double None (required)
diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php
new file mode 100644
index 00000000000..66f2ba08229
--- /dev/null
+++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php
@@ -0,0 +1,182 @@
+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));
+ }
+}
diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php
new file mode 100644
index 00000000000..1f3213e7516
--- /dev/null
+++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php
@@ -0,0 +1,318 @@
+ '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));
+ }
+}
diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php
new file mode 100644
index 00000000000..4d901dfd1c9
--- /dev/null
+++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php
@@ -0,0 +1,70 @@
+ 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
------------ | ------------- | ------------- | -------------
-*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* | [**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
@@ -117,10 +117,13 @@ Class | Method | HTTP request | Description
## Documentation for Models
- [Petstore::Animal](docs/Animal.md)
+ - [Petstore::AnimalFarm](docs/AnimalFarm.md)
- [Petstore::ApiResponse](docs/ApiResponse.md)
- [Petstore::Cat](docs/Cat.md)
- [Petstore::Category](docs/Category.md)
- [Petstore::Dog](docs/Dog.md)
+ - [Petstore::EnumClass](docs/EnumClass.md)
+ - [Petstore::EnumTest](docs/EnumTest.md)
- [Petstore::FormatTest](docs/FormatTest.md)
- [Petstore::Model200Response](docs/Model200Response.md)
- [Petstore::ModelReturn](docs/ModelReturn.md)
diff --git a/samples/client/petstore/ruby/docs/AnimalFarm.md b/samples/client/petstore/ruby/docs/AnimalFarm.md
new file mode 100644
index 00000000000..30d704dc7d1
--- /dev/null
+++ b/samples/client/petstore/ruby/docs/AnimalFarm.md
@@ -0,0 +1,7 @@
+# Petstore::AnimalFarm
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+
diff --git a/samples/client/petstore/ruby/docs/EnumClass.md b/samples/client/petstore/ruby/docs/EnumClass.md
new file mode 100644
index 00000000000..8d56e1f8873
--- /dev/null
+++ b/samples/client/petstore/ruby/docs/EnumClass.md
@@ -0,0 +1,7 @@
+# Petstore::EnumClass
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+
diff --git a/samples/client/petstore/ruby/docs/EnumTest.md b/samples/client/petstore/ruby/docs/EnumTest.md
new file mode 100644
index 00000000000..ad3ee5c31bb
--- /dev/null
+++ b/samples/client/petstore/ruby/docs/EnumTest.md
@@ -0,0 +1,10 @@
+# Petstore::EnumTest
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**enum_string** | **String** | | [optional]
+**enum_integer** | **Integer** | | [optional]
+**enum_number** | **Float** | | [optional]
+
+
diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md
index 32f2902d930..c0312e00f51 100644
--- a/samples/client/petstore/ruby/docs/FakeApi.md
+++ b/samples/client/petstore/ruby/docs/FakeApi.md
@@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2*
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(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
```ruby
@@ -41,7 +41,7 @@ opts = {
}
begin
- #Fake endpoint for testing various parameters
+ #Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb
index f203db3f5ba..1ca35820523 100644
--- a/samples/client/petstore/ruby/lib/petstore.rb
+++ b/samples/client/petstore/ruby/lib/petstore.rb
@@ -22,10 +22,13 @@ require 'petstore/configuration'
# Models
require 'petstore/models/animal'
+require 'petstore/models/animal_farm'
require 'petstore/models/api_response'
require 'petstore/models/cat'
require 'petstore/models/category'
require 'petstore/models/dog'
+require 'petstore/models/enum_class'
+require 'petstore/models/enum_test'
require 'petstore/models/format_test'
require 'petstore/models/model_200_response'
require 'petstore/models/model_return'
diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
index a0cf2913f43..68f6fea9d2b 100644
--- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
+++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
@@ -24,8 +24,8 @@ module Petstore
@api_client = api_client
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 double None
# @param string None
@@ -45,8 +45,8 @@ module Petstore
return nil
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 double None
# @param string None
diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb
new file mode 100644
index 00000000000..62ca66ce38b
--- /dev/null
+++ b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb
@@ -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<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+), (?.+)>\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
diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb
new file mode 100644
index 00000000000..4dc0bb6c16b
--- /dev/null
+++ b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb
@@ -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<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+), (?.+)>\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
diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb
new file mode 100644
index 00000000000..3f045b3490e
--- /dev/null
+++ b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb
@@ -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<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+), (?.+)>\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