How to use the json-schema-faker/lib.option function in json-schema-faker

To help you get started, we’ve selected a few json-schema-faker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github julienvincent / modelizr / src / mock.js View on Github external
quantity: 20,
            error: false,
            delay: 0,
            idType: INCREMENT,
            idGenerator: v4,
            ...this.getModification('mockConfig')
        }
        const gen = opts.idGenerator

        _.forEach(opts.extensions, (extension, name) => {
            jsf.extend(name, extension)
        })
        _.forEach(opts.formats, (format, name) => {
            jsf.format(name, format)
        })
        jsf.option(opts.jsfOptions)

        const mock = models => extractMockedObjects(mapValid(models, model => {
            if (typeof model.build === 'function') {
                model = model.build()
            }

            model._modelType = model._modelType || 'arrayOf'

            const primary = model.primaryKey || 'id'
            const response = {}

            const newId = opts.idType === INCREMENT ? _.size(cache[model.model ? model.model().getKey() : model.key]) + 1
                : gen()
            let id = newId

            if (model._modelType == 'arrayOf' || model._modelType == 'valuesOf') {