How to use enjoi - 1 common examples

To help you get started, we’ve selected a few enjoi 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 krakenjs / hapi-openapi / lib / validators.js View on Github external
type = 'number';
    }

    switch (format) {
        case 'int64':
        case 'byte':
        case 'binary':
        case 'date':
        case 'date-time':
            return format;
        default:
            return type;
    }
};

const enjoi = Enjoi.defaults({ types, refineType });

const create = function (options = {}) {

    const makeValidator = function (parameter, consumes) {
        const coerce = coercion(parameter, consumes);

        let schema;

        if ((parameter.in === 'body' || parameter.in === 'formData') && parameter.schema) {
            schema = enjoi.schema(parameter.schema);
        }
        else {
            const template = {
                required: parameter.required,
                enum: parameter.enum,
                type: parameter.type,

enjoi

Converts json-schema to Joi schema.

Apache-2.0
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis

Popular enjoi functions