How to use @webiny/validation - 10 common examples

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 / app-plugin-security-cognito / src / index.js View on Github external
renderUserForm({ Bind, data, fields }) {
            return (
                
                    
                        
                            {fields.email}
                            
                                
                                    <input label="{t2`Password`}" type="password" autocomplete="off">
                                
github webiny / webiny-js / packages / app-page-builder / src / admin / views / Categories / CategoriesForm.js View on Github external
<input label="{t`Name`}">
                                
                            
                            
                                
                                    <input label="{t`Slug`}" disabled="{data.id}">
                                
                            
                            
                                
                                    <input label="{t`URL`}" disabled="{data.id}">
                                
                            
                            
                                
                                    <select label="{t`Layout`}">
                                        {theme.layouts.map(({ name, title }) =&gt; (
                                            <option value="{name}">
                                                {title}
                                            </option>
                                        ))}
                                    </select>
github webiny / webiny-js / packages / api-page-builder / src / plugins / models / pbPageElement.model.js View on Github external
export default ({ createBase, context }) =>
    flow(
        withName("PbPageElement"),
        withFields({
            name: string({ validation: validation.create("required") }),
            category: string(),
            type: string({ validation: validation.create("required,in:element:block") }),
            content: content({ context }),
            preview: context.commodo.fields.id()
        })
    )(createBase({ maxPerPage: 1000 }));
github webiny / webiny-js / packages / app-forms / src / admin / plugins / validators / lte.js View on Github external
renderSettings({ Bind }) {
            return (
                
                    
                        
                            <input value="" is="" label="{&quot;Value&quot;}" type="{&quot;number&quot;}">
                        
                    
                
            );
        }
    }
github webiny / webiny-js / packages / app-typeform / src / admin / index.js View on Github external
render({ Bind }: Object) {
            return (
                } label="Typeform"&gt;
                    
                        
                            
                                <input label="{&quot;Typeform">
                            
                        
                    
                
            );
        }
    }
github webiny / webiny-js / packages / app-forms / src / admin / plugins / validators / minLength.js View on Github external
renderSettings({ Bind }) {
            return (
                
                    
                        
                            <input is="" label="{&quot;Value&quot;}" type="{&quot;number&quot;}">
                        
                    
                
            );
        }
    }
github webiny / webiny-js / packages / app-security / src / admin / views / Users / UsersForm.js View on Github external
{({ data, form, Bind }) =&gt; (
                
                    {crudForm.loading &amp;&amp; }
                    
                    
                        {auth.renderUserForm({
                            Bind,
                            data,
                            fields: {
                                firstName: (
                                    
                                        <input label="{t`First">
                                    
                                ),
                                lastName: (
                                    
                                        <input label="{t`Last">
                                    
                                ),
                                email: (
github webiny / webiny-js / packages / app-forms / src / admin / plugins / validators / pattern.js View on Github external
setMessage(selectedPatternPlugin.pattern.message);
                            }}
                        &gt;
                            <select label="{&quot;Preset&quot;}">
                                <option value="{&quot;custom&quot;}">Custom</option>
                                {presetPlugins.map(item =&gt; (
                                    <option value="{item.pattern.name}">
                                        {item.pattern.label}
                                    </option>
                                ))}
                            </select>
                        
                    
                    
                        
                            <input label="{&quot;Regex&quot;}" disabled="{inputsDisabled}">
                        
                    
                    
                        
                            <input label="{&quot;Flags&quot;}" disabled="{inputsDisabled}">

@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