Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@fastify/any-schema
Advanced tools
Save multiple schemas and decide which one use to serialize the payload Edit
Save multiple schemas and decide which one to use to serialize the payload.
Internally uses fast-json-stringify
to compile the schemas in extremely fast serialization functions, with all the benefits given by the library, such as preventing the leaking of sensitive data.
npm i @fastify/any-schema
Register the plugin and pass to it an array of schemas with an id, then use reply.schema(id)
to decide which schema to use to serialize your data.
const fastify = require('fastify')()
fastify.register(require('@fastify/any-schema'), {
schemas: [{
$id: 'schema1',
type: 'object',
properties: {
hello: { type: 'string' }
}
}, {
$id: 'schema2',
type: 'object',
properties: {
winter: { type: 'string' }
}
}]
})
fastify.get('/:schema', (req, reply) => {
reply
.schema(req.params.schema)
.send({ hello: 'world' })
})
fastify.listen({ port: 3000 }, err => {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})
This project is kindly sponsored by:
Licensed under MIT.
FAQs
Save multiple schemas and decide which one use to serialize the payload Edit
The npm package @fastify/any-schema receives a total of 3 weekly downloads. As such, @fastify/any-schema popularity was classified as not popular.
We found that @fastify/any-schema demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.