1.0.9 • Published 4 years ago

json-schema-fakify v1.0.9

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

JSON-Schema fakifier

Enhance your json-schema with faker decorations - to be used with json-schema-faker.

Installation

npm i json-schema-fakifier

Example

import {fakify} from "json-schema-fakifier";
import * as jsf from "json-schema-faker";
import {JSONSchema7} from "json-schema";

const origin = {
    type: 'object',
    properties: {
        firstName: {
            type: 'string'
        },
        lastName: {
            type: 'string'
        },
        email: {
            type: 'string'
        },
        phones: {
            type: 'array',
            minItems: 1,
            items: {
                type: 'string'
            }
        }
    }
} as JSONSchema7;
console.log(`~~~ take your original schema:`, origin);

const fakified = fakify(origin);
console.log(`~~~ fakify it:`, fakified);

console.log(`~~~ then use it to make a fake:`);
jsf.extend('faker', () => require('faker'));
console.log(jsf.generate(fakified));

Contributing

After cloning locally and npm i, you can run the following scripts:

npm start    // to start the example above
npm run test // test files in spec dir
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago