Skip to content

Commit 54a1f27

Browse files
committed
Fixed creating an empty object according to the nested JSON schema.
1 parent 89f5161 commit 54a1f27

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- fixed unexpected errors with the stream when handling static files
1414
- added support for `.webmanifest` file extension
1515
- fixed sending mail attachments
16+
- fixed creating an empty object according to the nested JSON schema
1617

1718
========================
1819
0.0.14

jsonschema.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,8 @@ function check_array(meta, error, value, stop, definitions, path, partial) {
513513
function check_object(meta, error, value, response, stop, definitions, path, partial) {
514514

515515
if (!value || typeof(value) !== 'object') {
516-
if (meta.$$REQUIRED) {
516+
if (meta.$$REQUIRED)
517517
error.push(meta.$$ID, path);
518-
}
519518
return;
520519
}
521520

@@ -583,7 +582,6 @@ function check_object(meta, error, value, response, stop, definitions, path, par
583582
break;
584583

585584
case 'object':
586-
587585
if (prop.properties) {
588586
tmp = check_object(prop, error, val, null, null, definitions, currentpath, partial);
589587
if (tmp != null) {
@@ -690,7 +688,8 @@ function transform(meta, error, value, stop, path, partial) {
690688
if (stop && error.length)
691689
return;
692690

693-
return output || {};
691+
// return output || {}; // It always creates an empty object, which is not expected.
692+
return output;
694693
}
695694

696695
function register(schema) {

0 commit comments

Comments
 (0)