Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metaschema

Package Overview
Dependencies
Maintainers
5
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metaschema - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

9

CHANGELOG.md

@@ -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

12

lib/schema.js

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc