Merge branch 'feature/js-fix-types' of https://github.com/arikon/swagger-codegen into arikon-feature/js-fix-types

This commit is contained in:
wing328 2016-08-12 10:08:24 +08:00
commit 02f43bc195
2 changed files with 9 additions and 9 deletions

View File

@ -113,7 +113,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
);
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList("String", "Boolean", "Integer", "Number", "Array", "Object", "Date", "File")
Arrays.asList("String", "Boolean", "Number", "Array", "Object", "Date", "File")
);
defaultIncludes = new HashSet<String>(languageSpecificPrimitives);
@ -126,17 +126,17 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
typeMapping.put("List", "Array");
typeMapping.put("boolean", "Boolean");
typeMapping.put("string", "String");
typeMapping.put("int", "Integer"); // Huh? What is JS Integer?
typeMapping.put("int", "Number");
typeMapping.put("float", "Number");
typeMapping.put("number", "Number");
typeMapping.put("DateTime", "Date"); // Should this be dateTime?
typeMapping.put("date", "Date"); // Should this be date?
typeMapping.put("long", "Integer");
typeMapping.put("short", "Integer");
typeMapping.put("DateTime", "Date");
typeMapping.put("date", "Date");
typeMapping.put("long", "Number");
typeMapping.put("short", "Number");
typeMapping.put("char", "String");
typeMapping.put("double", "Number");
typeMapping.put("object", "Object");
typeMapping.put("integer", "Integer");
typeMapping.put("integer", "Number");
// binary not supported in JavaScript client right now, using String as a workaround
typeMapping.put("ByteArray", "String"); // I don't see ByteArray defined in the Swagger docs.
typeMapping.put("binary", "String");

View File

@ -52,10 +52,10 @@ public class JavaScriptModelTest {
Assert.assertEquals(property1.baseName, "id");
Assert.assertEquals(property1.getter, "getId");
Assert.assertEquals(property1.setter, "setId");
Assert.assertEquals(property1.datatype, "Integer");
Assert.assertEquals(property1.datatype, "Number");
Assert.assertEquals(property1.name, "id");
Assert.assertEquals(property1.defaultValue, null);
Assert.assertEquals(property1.baseType, "Integer");
Assert.assertEquals(property1.baseType, "Number");
Assert.assertTrue(property1.hasMore);
Assert.assertTrue(property1.required);
Assert.assertTrue(property1.isNotContainer);