typescript-json-schema-faker
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

typescript-json-schema-faker

Build Status npm version

A random data generator for typescript based on https://github.com/json-schema-faker/json-schema-faker

Installation

npm install typescript-json-schema-faker -D

or

yarn add typescript-json-schema-faker -D

Usage

import fake, { JsonSchema } from "typescript-json-schema-faker";
 
const schema: JsonSchema = {
    id: "someSchemaId",
    type: "object",
    required: ["foo", "bar", "baz"],
    properties: {
        foo: {
            type: "string",
            chance: "guid",
        },
        bar: {
            type: "array",
            minItems: 1,
            maxItems: 10,
            items: {
                type: "number",
            },
        }
        baz{
            $ref: "otherSchemaId",
        }
    },
};
 
console.log(fake(schema));

more usage: https://github.com/json-schema-faker/json-schema-faker#supported-keywords

License

MIT

Package Sidebar

Install

npm i typescript-json-schema-faker

Weekly Downloads

236

Version

0.0.10

License

MIT

Unpacked Size

279 kB

Total Files

16

Last publish

Collaborators

  • 297951292