diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-05-24 18:53:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 18:53:42 -0400 |
commit | 900bceda47e4c736e70a66e66cfce719b4c6d203 (patch) | |
tree | 045267dcafa66fcfe95897fb78942663590e1939 /ext/js/data | |
parent | 54e102f343b651ac41b2ce34d38a3a4638192d4a (diff) |
Fix json schema array properties (#1709)
* Fix proxy array properties being handled incorrectly
* Add tests to check array properties
Diffstat (limited to 'ext/js/data')
-rw-r--r-- | ext/js/data/json-schema.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/js/data/json-schema.js b/ext/js/data/json-schema.js index a6306c3a..8fb920fc 100644 --- a/ext/js/data/json-schema.js +++ b/ext/js/data/json-schema.js @@ -852,11 +852,12 @@ class JsonSchemaProxyHandler { let propertySchema; if (Array.isArray(target)) { - property = this._getArrayIndex(property); - if (property === null) { + const index = this._getArrayIndex(property); + if (index === null) { // Note: this does not currently wrap mutating functions like push, pop, shift, unshift, splice return target[property]; } + property = index; propertySchema = this._schema.getArrayItemSchema(property); } else { propertySchema = this._schema.getObjectPropertySchema(property); |