metaschema
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -5,2 +5,8 @@ # Changelog | ||
## [1.3.4][] - 2021-09-10 | ||
- Show path to the field in warnings | ||
- Remove spread operator in `toLongForm` | ||
- Update dependencies | ||
## [1.3.3][] - 2021-07-19 | ||
@@ -98,3 +104,4 @@ | ||
[unreleased]: https://github.com/metarhia/metaschema/compare/v1.3.3...HEAD | ||
[unreleased]: https://github.com/metarhia/metaschema/compare/v1.3.4...HEAD | ||
[1.3.4]: https://github.com/metarhia/metaschema/compare/v1.3.3...v1.3.4 | ||
[1.3.3]: https://github.com/metarhia/metaschema/compare/v1.3.2...v1.3.3 | ||
@@ -101,0 +108,0 @@ [1.3.2]: https://github.com/metarhia/metaschema/compare/v1.3.1...v1.3.2 |
@@ -182,3 +182,3 @@ 'use strict'; | ||
if (!required) type = type.substring(1); | ||
const def = short ? toLongForm(type, { ...entry }) : entry; | ||
const def = short ? toLongForm(type, entry) : entry; | ||
if (!Reflect.has(def, 'required')) def.required = required; | ||
@@ -242,3 +242,3 @@ if (def.length) def.length = formatLength(def.length); | ||
check(value) { | ||
check(value, path = '') { | ||
const target = this.kind === 'scalar' ? { value } : value || {}; | ||
@@ -262,7 +262,7 @@ const keys = Object.keys(target); | ||
if (!def) { | ||
errors.push(`Field "${name}" is not expected`); | ||
errors.push(`Field "${path}${name}" is not expected`); | ||
continue; | ||
} | ||
if (def instanceof Schema) { | ||
const subcheck = def.check(value); | ||
const subcheck = def.check(value, name + '.'); | ||
if (!subcheck.valid) errors.push(...subcheck.errors); | ||
@@ -272,3 +272,3 @@ continue; | ||
if (def.json instanceof Schema) { | ||
const subcheck = def.json.check(value); | ||
const subcheck = def.json.check(value, name + '.'); | ||
if (!subcheck.valid) errors.push(...subcheck.errors); | ||
@@ -278,3 +278,3 @@ continue; | ||
if (def.required && !keys.includes(name)) { | ||
errors.push(`Field "${name}" is required`); | ||
errors.push(`Field "${path}${name}" is required`); | ||
continue; | ||
@@ -281,0 +281,0 @@ } |
{ | ||
"name": "metaschema", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -46,16 +46,16 @@ "description": "Metadata Schema and Interface Definition Language (IDL)", | ||
"dependencies": { | ||
"metautil": "^3.5.6", | ||
"metautil": "^3.5.11", | ||
"metavm": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^16.3.3", | ||
"eslint": "^7.31.0", | ||
"@types/node": "^16.9.1", | ||
"eslint": "^7.32.0", | ||
"eslint-config-metarhia": "^7.0.1", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"metatests": "^0.7.2", | ||
"prettier": "^2.3.2", | ||
"typescript": "^4.3.5" | ||
"prettier": "^2.4.0", | ||
"typescript": "^4.4.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23059
Updatedmetautil@^3.5.11