diff --git a/lib/dot/propertyNames.jst b/lib/dot/propertyNames.jst index 51caffc20..ee52b2151 100644 --- a/lib/dot/propertyNames.jst +++ b/lib/dot/propertyNames.jst @@ -3,6 +3,8 @@ {{# def.setupKeyword }} {{# def.setupNextLevel }} +var {{=$errs}} = errors; + {{? {{# def.nonEmptySchema:$schema }} }} {{ $it.schema = $schema; @@ -22,8 +24,6 @@ , $currentBaseId = it.baseId; }} - var {{=$errs}} = errors; - {{? $ownProperties }} var {{=$dataProperties}} = undefined; {{?}} diff --git a/spec/tests/issues/861_empty_propertynames.json b/spec/tests/issues/861_empty_propertynames.json new file mode 100644 index 000000000..55ce3501f --- /dev/null +++ b/spec/tests/issues/861_empty_propertynames.json @@ -0,0 +1,23 @@ +[ + { + "description": "propertyNames with empty schema (#861)", + "schema": { + "properties": { + "foo": {"type": "string"} + }, + "propertyNames": {} + }, + "tests": [ + { + "description": "valid", + "data": {"foo": "bar"}, + "valid": true + }, + { + "description": "invalid", + "data": {"foo": 1}, + "valid": false + } + ] + } +]