Skip to content

Commit 79eebd8

Browse files
committed
Fixed returing a default JSON schema object in actions.
1 parent ee51277 commit 79eebd8

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

builders.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ ActionCaller.prototype.exec = function() {
14291429

14301430
if (!err) {
14311431
if (action.jsoutput)
1432-
response = action.jsoutput.transform(response).response;
1432+
response = action.jsoutput.transform(response).response || {};
14331433

14341434
if (action.extend) {
14351435
if (action.extend.includes('.'))
@@ -1493,7 +1493,7 @@ ActionCaller.prototype.exec = function() {
14931493
self.cancel();
14941494
return;
14951495
}
1496-
$.query = response.response;
1496+
$.query = response.response || {};
14971497
} else
14981498
$.query = query;
14991499

@@ -1505,7 +1505,7 @@ ActionCaller.prototype.exec = function() {
15051505
self.cancel();
15061506
return;
15071507
}
1508-
$.params = response.response;
1508+
$.params = response.response || {};
15091509
} else
15101510
$.params = params;
15111511

@@ -1515,7 +1515,7 @@ ActionCaller.prototype.exec = function() {
15151515
self.cancel();
15161516
return;
15171517
}
1518-
$.payload = response.response;
1518+
$.payload = response.response || {};
15191519
} else
15201520
$.payload = payload;
15211521

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- replaced `Url.parse()` with `new URL()`
3030
- fixed `NEWFORK()` method
3131
- fixed callback with `$` in the `ACTION().callback($)`
32+
- fixed returing a default JSON schema object in actions
3233

3334
========================
3435
0.0.15

jsonschema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ function check_object(meta, error, value, response, stop, definitions, path, par
662662

663663
function transform(meta, error, value, stop, path, partial) {
664664

665-
var output;
665+
let output;
666666

667667
switch (meta.type) {
668668
case 'string':

utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6026,8 +6026,9 @@ SP.toJSONSchema = SP.parseSchema = function(name, url) {
60266026
// let type = typename.toLowerCase().trim();
60276027
let size = 0;
60286028
let isarr = type[0] === '[';
6029-
if (isarr)
6030-
type = type.substring(1, type.length - 1);
6029+
if (isarr) {
6030+
type = type.substring(1, type.indexOf(']'));
6031+
}
60316032

60326033
let nestedschema = '';
60336034
let isenum = type[0] === '{';

0 commit comments

Comments
 (0)