wcv

waterline-custom-validations

a library to help build validation messages that mimic the structure of waterline 0.10 validation messages

Showing:

Popularity

Downloads/wk

2

GitHub Stars

2

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

custom-validations

Library to help build validation messages that mimic the structure of waterline 0.10 validation messages.

This can be useful if you are already using waterline, and don't want to have to translate their structure into some other arbitrary structure.

The waterline validation error format is:

{
  invalidAttributes: {
    fieldName1: [
      { rule: 'someRuleName', message: 'some friendly rule message' },
      { rule: 'anotherRuleName', message: 'another friendly rule message' }
    ],
    fieldName2: [
      { rule: 'someRuleName', message: 'some friendly rule message' }
    ]
  }
}

actual waterline objects have a lot more properties/fields than this, as well as backwards compatibility for Sails 0.9x validation messages that use the ValidationError property to hold the validation errors. To see a full implementation of the waterline validation errors, see the WLValidationError source in Waterline

development

To run the tests, clone the repo, then

  • npm install
  • npm test

You can also get code coverage on the tests by running

npm run cover

contributing

To contribute, see CONTRIBUTING.md

license

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100