Skip to content

jefersondaniel/json-schema-validation-strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-schema-validation-strategy

Build Status npm version

JSON Schema validation strategy for react-validation-mixin.

This library provides a validation strategy based on the library jsen

Custom messages and i18n

Property name override

validatorTypes:  {
  type: 'object',
  required: ['username'],
  properties: {
    username: {
      type: 'string',
      label: 'Field name'
    }
  }
}

Message override

validatorTypes:  {
  type: 'object',
  required: ['username'],
  properties: {
    username: {
      type: 'string',
      minLength: 5,
      invalidMessage: 'Invalid username',
      requiredMessage: 'Username is required'
    }
  }
}

Global message override

const options = {
  messages: {
    required: '{{key}} custom required message.'
  }
}

export default validation(strategy(options))(component);

About

JSON schema validator for react-validation-mixin

Resources

License

Stars

Watchers

Forks

Packages

No packages published