forked from loafle/openapi-generator-original
Merge pull request #1109 from swagger-api/rebase-issue-838
update files as rebase from #838
This commit is contained in:
commit
ec9cdca7cb
@ -15,7 +15,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String invokerPackage = "Swagger\\Client";
|
||||
@ -61,6 +61,11 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
instantiationTypes.put("array", "array");
|
||||
instantiationTypes.put("map", "map");
|
||||
|
||||
|
||||
// provide primitives to mustache template
|
||||
String primitives = "'" + StringUtils.join(languageSpecificPrimitives, "', '") + "'";
|
||||
additionalProperties.put("primitives", primitives);
|
||||
|
||||
// ref: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("integer", "int");
|
||||
|
@ -193,7 +193,7 @@ class ObjectSerializer
|
||||
$deserialized = $values;
|
||||
} elseif ($class === '\DateTime') {
|
||||
$deserialized = new \DateTime($data);
|
||||
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool', 'object'))) {
|
||||
} elseif (in_array($class, array({{&primitives}}))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
|
@ -193,7 +193,7 @@ class ObjectSerializer
|
||||
$deserialized = $values;
|
||||
} elseif ($class === '\DateTime') {
|
||||
$deserialized = new \DateTime($data);
|
||||
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool', 'object'))) {
|
||||
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user