forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
@@ -22,6 +22,7 @@ import io.swagger.models.Operation;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.ByteArrayProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
@@ -113,7 +114,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList("String", "Boolean", "Number", "Array", "Object", "Date", "File")
|
||||
Arrays.asList("String", "Boolean", "Number", "Array", "Object", "Date", "File", "Blob")
|
||||
);
|
||||
defaultIncludes = new HashSet<String>(languageSpecificPrimitives);
|
||||
|
||||
@@ -138,8 +139,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
typeMapping.put("object", "Object");
|
||||
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");
|
||||
typeMapping.put("ByteArray", "Blob"); // I don't see ByteArray defined in the Swagger docs.
|
||||
typeMapping.put("binary", "Blob");
|
||||
typeMapping.put("UUID", "String");
|
||||
|
||||
importMapping.clear();
|
||||
@@ -652,7 +653,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
* @return Normalized type
|
||||
*/
|
||||
public String normalizeType(String type) {
|
||||
return type.replaceAll("\\b(Boolean|Integer|Number|String|Date)\\b", "'$1'");
|
||||
return type.replaceAll("\\b(Boolean|Integer|Number|String|Date|Blob)\\b", "'$1'");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -441,6 +441,10 @@
|
||||
request.accept(accept);
|
||||
}
|
||||
|
||||
if (returnType === 'Blob') {
|
||||
request.responseType('blob');
|
||||
}
|
||||
|
||||
// Attach previously saved cookies, if enabled
|
||||
if (this.enableCookies){
|
||||
if (typeof window === 'undefined') {
|
||||
@@ -521,6 +525,8 @@
|
||||
return String(data);
|
||||
case 'Date':
|
||||
return this.parseDate(String(data));
|
||||
case 'Blob':
|
||||
return data;
|
||||
default:
|
||||
if (type === Object) {
|
||||
// generic object, return directly
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"test": "./node_modules/mocha/bin/mocha --recursive"
|
||||
},
|
||||
"dependencies": {
|
||||
"superagent": "1.7.1"
|
||||
"superagent": "3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~2.3.4",
|
||||
|
||||
@@ -438,12 +438,12 @@
|
||||
{{/licenseUrl}}
|
||||
</div>
|
||||
</div>
|
||||
<div id="generator">
|
||||
{{^hideGenerationTimestamp}} <div id="generator">
|
||||
<div class="content">
|
||||
Generated {{generatedDate}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/hideGenerationTimestamp}} </div>
|
||||
</div>
|
||||
</div>
|
||||
{{>js_jsonformatter}}
|
||||
|
||||
@@ -420,10 +420,10 @@ public class JavaScriptModelTest {
|
||||
Assert.assertEquals(property.baseName, "inputBinaryData");
|
||||
Assert.assertEquals(property.getter, "getInputBinaryData");
|
||||
Assert.assertEquals(property.setter, "setInputBinaryData");
|
||||
Assert.assertEquals(property.datatype, "String");
|
||||
Assert.assertEquals(property.datatype, "Blob");
|
||||
Assert.assertEquals(property.name, "inputBinaryData");
|
||||
Assert.assertEquals(property.defaultValue, null);
|
||||
Assert.assertEquals(property.baseType, "String");
|
||||
Assert.assertEquals(property.baseType, "Blob");
|
||||
Assert.assertFalse(property.hasMore);
|
||||
Assert.assertFalse(property.required);
|
||||
Assert.assertTrue(property.isNotContainer);
|
||||
|
||||
Reference in New Issue
Block a user