
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
structured-jayschema-errors
Advanced tools
Return jayschema error messages with the same structure as the validated data
Return jayschema error messages with the same structure as the validated data
var JaySchema = require('jayschema');
var jaySchema = new JaySchema();
var structureErrors = require('structured-jayschema-errors');
var data = {
a: 1,
b: {
c: "3",
d: 4
}
};
schema = {
"type": "object",
"properties": {
"a": {
"type": "string"
},
"b": {
"type": "object",
"additionalProperties": false,
"properties": {
"c": {
"type": "number"
}
}
}
}
};
var errors = jaySchema.validate(data, schema);
var structuredErrors = structureErrors(myJaySchemaErrorsOutput);
//results in:
{
a: {
[Error]
instanceContext: '#/a',
resolutionScope: 'anon...',
constraintName: 'type',
constraintValue: 'string',
testedValue: 'integer'
},
b: {
c: {
[Error]
instanceContext: '#/b/c',
resolutionScope: 'anon-...',
constraintName: 'type',
constraintValue: 'number',
testedValue: 'string'
},
d: {
[Error]
instanceContext: '#/b',
resolutionScope: 'anon-...',
constraintName: 'additionalProperties',
testedValue: 'd',
desc: 'property "d" not allowed by...',
kind: 'ObjectValidationError'
}
}
}
Additionally you can pass a function to transform the errors.
For example, you may want to transform the errors into a human readable form.
var errors = jaySchema.validate(data, schema),
transformErrors = require('./my-error-transform-function');
var structuredErrors = structureErrors(myJaySchemaErrorsOutput, transformErrors);
//results in:
{
a: 'Should be a string',
b: {
c: 'Should be a number',
d: 'Property not allowed'
}
}
FAQs
Return jayschema error messages with the same structure as the validated data
We found that structured-jayschema-errors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.