
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
goodeggs-json-schema-validator
Advanced tools
npm install goodeggs-json-schema-validator
Adds support for these formats:
Simply include the format in your schema:
{"type": "string", "format": "date"}
(Loosely modeled on express-joi-validator.)
When validation fails, uses Boom to wrap errors. Recommended to use Crashpad for passing those errors to the client.
All methods return middleware that can be use()
d or included in a route chain.
validateQuery(schema, options)
validates schema against req.query
validateParams(schema, options)
validates schema against req.params
validateBody(schema, options)
validates schema against req.body
(requires body-parser)The schema
param should be a JSON Schema,
including properties
, required
, etc. Its type
defaults to object
.
Validate URL params:
var jsonValidator = require('goodeggs-json-schema-validator');
var crashpad = require('crashpad')
app.use(crashpad()); // for responding with structured errors
app.get('/products/:slug',
jsonValidator.validateParams({
properties:
'slug':
type: 'string'
pattern: '^[a-z-]+$'
}),
function (req, res) {
// ...
}
);
If a request is made to /products/INVALID_123
,
it will fail with statusCode 400
and a body containing message
with a description of the error.
Please follow our Code of Conduct when contributing to this project.
$ git clone https://github.com/goodeggs/goodeggs-json-schema-validator && cd goodeggs-json-schema-validator
$ npm install
$ npm test
FAQs
Good Eggs JSON Schema Validator
The npm package goodeggs-json-schema-validator receives a total of 7 weekly downloads. As such, goodeggs-json-schema-validator popularity was classified as not popular.
We found that goodeggs-json-schema-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.