Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 876 Bytes

DEPRECATED.md

File metadata and controls

57 lines (36 loc) · 876 Bytes

Deprecation Notice

Importing

Don't use the default export

CommonJS:

const JSONSchemaFaker = require("json-schema-faker");

ESM:

import JSONSchemaFaker from "json-schema-faker";

Do use the named export

CommonJS:

const { JSONSchemaFaker } = require("json-schema-faker");

ESM:

import { JSONSchemaFaker } from "json-schema-faker";

API

Don't call JSONSchemaFaker as a function

This API is deprecated.

const data = JSONSchemaFaker(schema, refs, cwd);

Do call .generate()

This code is equivalent to the previous snippet.

const data = JSONSchemaFaker.generate(schema, refs, cwd);

Do call .resolve()

If possible, use async / await and .resolve() to generate data without blocking the thread.

const data = await JSONSchemaFaker.resolve(schema, refs, cwd);