Giter VIP home page Giter VIP logo

olifer's People

Contributors

prots avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ledest

olifer's Issues

The rule list_of doesn't work

Description the rule list_of:

Allows you to describe validation rules for a list. Validation rules will be applyed for each array element.

Error code: depends on nested validators

Example:

// new syntax (introduced in v0.4)
{ product_ids: { 'list_of': 'positive_integer' }}
{ product_ids: { 'list_of': ['required', 'positive_integer'] }} // new syntax

Please fix this functionality. Best regards!

Can't find a rule in a rules list

Here is an example, where i have received an error in validation

Data for validation

[{<<"id">>,<<"323232121133232">>},
 {<<"src_addr">>,<<"some.link">>},
 {<<"dst_addr">>,<<"+380990000000">>},
 {<<"category">>,<<"qwerty">>},
 {<<"message_template">>,
  [[{<<"text">>,<<"some text here">>}]]}].

Rules for olifer

[{<<"id">>,
  [<<"required">>,
   [{<<"max_length">>,64}],
   [{<<"like">>,<<"^[A-Za-z_0-9]{1,64}$">>}]]},
 {<<"src_addr">>,
  [<<"required">>,<<"not_empty">>,
   [{<<"like">>,<<"^[A-Za-z_.0-9]{1,64}$">>}]]},
 {<<"dst_addr">>,
  [<<"required">>,<<"not_empty">>,
   [{<<"like">>,<<"^\\+(380[0-9]{9}|[1-9][0-9]{7,14})$">>}]]},
 {<<"category">>,
  [<<"not_empty">>,
   [{<<"max_length">>,64}],
   [{<<"like">>,<<"^[A-Za-z_0-9]{1,64}$">>}]]},
 {<<"message_template">>,
  [<<"required">>,
   [{<<"list_of_objects">>,
     [{<<"text">>,[<<"not_empty">>]}]}]]}]

In version olifer 0.4.0 it returns:

{ok,[{<<"id">>,<<"323232121133232">>},
     {<<"src_addr">>,<<"some.link">>},
     {<<"dst_addr">>,<<"+380990000000">>},
     {<<"category">>,<<"qwerty">>},
     {<<"message_template">>,
      [[{<<"text">>,<<"some text here">>}]]}]}

In version olifer 0.4.1 it returns an error:

{errors,[{<<"message_template">>,
          [<<"Rule 'text' not_registered">>]}]}

Add support of LIVR 2.0

List of changes v2.0 (see spec for details)

  • Switched to semver. New release version is 2.0
  • Unified approach to types handling
  • "Base rules" renamed to "Common rules".
  • "Filter rules" renamed to "Modifiers". They do not validate anything, just modify data.
  • "Helper rules" renamed to "Metarules" as this rules are for describing other rules
  • Added common rule "any_object"
  • Added string rule "string"
  • Added string rule "eq"
  • Added metarule "variable_object"
  • Added metarule "or"
  • Added modifier "default"
  • Add more edge cases to test suite
  • Add experimental status to the "like" rule

All you need is to update your implementation to pass the latest spec's test suite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.