UNPKG

typebox-schema-faker

Version:

Generate fake data from TypeBox schemas for testing, prototyping and development.

16 lines (15 loc) 444 B
/** * Generates fake data for unknown schemas */ export const fakeUnknown = (_schema, ctx) => { const generators = [ () => ctx.faker.string.alphanumeric(8), () => ctx.faker.number.int({ min: 0, max: 1000 }), () => ctx.faker.datatype.boolean(), () => null, () => ({}), () => [], ]; const randomGenerator = ctx.faker.helpers.arrayElement(generators); return randomGenerator(); };