Handle arbitrary object in JS client

Closes #2165

Other changes:

* Update JS client of the Petstore sample
* Add test cases for getPetByIdInObject and getInventoryInObject
This commit is contained in:
xhh
2016-03-04 18:40:03 +08:00
parent adc4547c8c
commit 8d964cff52
12 changed files with 439 additions and 184 deletions

View File

@@ -306,7 +306,10 @@
case 'Date':
return this.parseDate(String(data));
default:
if (typeof type === 'function') {
if (type === Object) {
// generic object, return directly
return data;
} else if (typeof type === 'function') {
// for model type like: User
var model = type.constructFromObject(data);
return model;