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.
@ovotech/avro-mock-generator
Advanced tools
Create mock messages from Avro schemas.
Call the generator with the schema:
import generateMsg from '@ovotech/avro-mock-generator'
const schema = {
type: 'record',
fields: [{ name: 'nbChickens', type: 'int' }],
}
console.log(generateData(schema));
// { nbChickens: 25672672 }
All fields will contain randomly generated data that respects their type.
An options
object can optionnaly be provide as the second argument.
Supported Options:
generators
: An key
/value
object of generator functions.
key
: the type
(or logicalType
)value
: should be a generator function (type, context) => value
where - type
: the content of the type
field in the schema, either a string
for simple type, or the type configuration for complex types - context
: an object with contextual data, including the generators
It is possible to override the default generators, and add support for extra types/logicalTypes by providingpickUnion
: Array of strings to drive which member of union type to choose. Can be the short name of fully namespaced names. When this option is not provided, the first element in the union will be chosenUse the Seeded
factory to create a version of the generator that will use deterministic randomness.
The factory will return a function with the same signature as the default generator.
Based on the Avro 1.9.0 specification.
options
parameter. If a logicalType
is missing a generator, data will be generated matching the underlying type
.enum
types, the first element of the array will always be chosen.Partial support for namespaces. Only union types are namespaced, unconditionally.
All contributions are welcome, just fork the repository then create a PR. Once merged we will release a new version.
Simply create a new release on master, with the tag being the new version (eg: 1.0.0).
FAQs
Generate mock messages from an avro schema
The npm package @ovotech/avro-mock-generator receives a total of 687 weekly downloads. As such, @ovotech/avro-mock-generator popularity was classified as not popular.
We found that @ovotech/avro-mock-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 354 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.