
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@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 2,792 weekly downloads. As such, @ovotech/avro-mock-generator popularity was classified as 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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.