Successfully reported this slideshow.

Livr 2.0 in JS - Vinnytsia.JS 2019

0

Share

Loading in …3
×
1 of 38
1 of 38

Livr 2.0 in JS - Vinnytsia.JS 2019

0

Share

Download to read offline

Having 15-year experience in web development, I have tried my hands at dozens of validation libraries but didn’t manage to find the one to handle all my tasks. 5 years ago we decided to create a validator which will better than any other. Now LIVR supports a dozen of programming languages and it is battle tested in hudrends of projects. I will talk about the ideas behind, about architecture, use cases, pros and cons. Will show real examples.

Having 15-year experience in web development, I have tried my hands at dozens of validation libraries but didn’t manage to find the one to handle all my tasks. 5 years ago we decided to create a validator which will better than any other. Now LIVR supports a dozen of programming languages and it is battle tested in hudrends of projects. I will talk about the ideas behind, about architecture, use cases, pros and cons. Will show real examples.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Livr 2.0 in JS - Vinnytsia.JS 2019

  1. 1. Language Independent Validation Rules (LIVR) 2.0 Viktor Turskyi CEO at WebbyLab
  2. 2. Viktor Turskyi ● CEO and principal architect at WebbyLab ● Open source developer ● More than 15 years of experience ● Delivered more than 60 projects of different scale ● Did projects for 5 companies from Fortune 500 list
  3. 3. Joi size https://github.com/jeffbski/joi-browser
  4. 4. 7 years ago we decided to create own data validation library
  5. 5. Why?
  6. 6. 10 issues of existing validators
  7. 7. Issue 1: Some validators pass through fields which have no validation rules described Issue 2: Some validators fails on the first error
  8. 8. Issue 3: Some validators use procedural rules Issue 4: Some validators describe validation as a code
  9. 9. Issue 5: Some validators have non standardized error messages. Like “Field name is required” Issue 6: Some validators have numeric error codes
  10. 10. Issue 7: Some validators do not support hierarchical data structures Issue 8: Some validators are limited by built-in rules
  11. 11. Issue 9: Some validators have to broad responsibility. Like working with HTML etc Issue 10: Some validators do not support transformation of validation data
  12. 12. How?
  13. 13. Example: validate registration data
  14. 14. LIVR Specification 2.0 http://livr-spec.org/
  15. 15. Battle tested Test Suite for implementations
  16. 16. LIVR - Mustache in the world of Data Validation
  17. 17. What is Mustache? o_O
  18. 18. Example: validate registration data
  19. 19. Syntax details # Short form password: [ 'required', {min_length: 10} ] # Full form password: [ {required: [ ] }, { min_length: [10] } ]
  20. 20. Example: validate nested object
  21. 21. Example: validate list
  22. 22. Example: validate list of objects
  23. 23. Example: output modification (pipelines)
  24. 24. IMPLEMENTATION
  25. 25. Small universal core, all features are in rules For the core there is no difference between: ‘required’, ‘nested_object’, ‘trim’.
  26. 26. Aliased Rules
  27. 27. Custom rules
  28. 28. Using LIVR for REST API Request: POST /users
  29. 29. Response which looks better than “Bad request” :)
  30. 30. JS Implementation features ● Zero dependencies ● Passes 100% of spec tests ● Works in NodeJs and in a browser ● Validator itself 1008 B (min+gzip) ● Validator with all rules 2.84KB (min+gzip) ● Extra rules pack - livr-extra-rules (zero deps)
  31. 31. Links ● LIVR Specification ● LIVR Playground ● Universal test suite ● LIVR - Data Validation Without Any Issues
  32. 32. Telegram: @JABASCRIPT
  33. 33. Viktor Turskyi viktor@webbylab.com @koorchik @koorchik https://webbylab.com

×