How to use the @webiny/validation.validation.validate function in @webiny/validation

To help you get started, we’ve selected a few @webiny/validation 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 webiny / webiny-js / packages / api-cms / src / plugins / validators.js View on Github external
async validate(value, options, { field, entity }) {
            // If it's an existing entity, most likely it already has all the required values.
            // We do this fast check to be sure, and skip validation if value is already set.
            const attribute = entity.getAttribute(field.fieldId);
            if (attribute && (await attribute.getValue())) {
                return;
            }
            await validation.validate(value, "required");
        }
    },
github webiny / webiny-js / packages / api-forms / src / plugins / validators / lte.js View on Github external
validate: (value, validator) => {
            const lteValue = validator.settings.value;
            if (typeof lteValue !== "undefined") {
                return validation.validate(value, `lte:${lteValue}`);
            }
        }
    }
github webiny / webiny-js / packages / api-cms / src / plugins / validators.js View on Github external
async validate(value, { min }) {
            await validation.validate(value, `minLength:${min}`);
        }
    }
github webiny / webiny-js / packages / app-forms / src / site / plugins / validators / required.js View on Github external
validate: value => {
            return validation.validate(value, "required");
        }
    }
github webiny / webiny-js / packages / api-forms / src / plugins / validators / required.js View on Github external
validate: value => {
            return validation.validate(value, "required");
        }
    }
github webiny / webiny-js / packages / api-forms / src / plugins / validators / minLength.js View on Github external
validate: (value, validator) => {
            const minLengthValue = validator.settings.value;
            if (typeof minLengthValue !== "undefined") {
                return validation.validate(value, `minLength:${minLengthValue}`);
            }
        }
    }
github webiny / webiny-js / packages / api-forms / src / plugins / validators / gte.js View on Github external
validate: (value, validator) => {
            const gteValue = validator.settings.value;
            if (typeof gteValue !== "undefined") {
                return validation.validate(value, `gte:${gteValue}`);
            }
        }
    }
github webiny / webiny-js / packages / api-forms / src / plugins / validators / maxLength.js View on Github external
validate: (value, validator) => {
            const maxLengthValue = validator.settings.value;
            if (typeof maxLengthValue !== "undefined") {
                return validation.validate(value, `maxLength:${maxLengthValue}`);
            }
        }
    }
github webiny / webiny-js / packages / api-forms / src / plugins / validators / in.js View on Github external
validate: (value, validator) => {
            const values = validator.settings.values;
            if (Array.isArray(values)) {
                return validation.validate(value, `in:${values.join(":")}`);
            }
        }
    }

@webiny/validation

A simple data validation library, packed with frequently used validators.

MIT
Latest version published 2 days ago

Package Health Score

86 / 100
Full package analysis

Similar packages