GithubHelp home page GithubHelp logo

erlangbureau / liver Goto Github PK

View Code? Open in Web Editor NEW
36.0 36.0 11.0 142 KB

Lightweight Erlang validator based on LIVR specification

License: MIT License

Makefile 0.62% Erlang 99.38%
erlang json livr validator

liver's People

Contributors

kostiushkin avatar maximilyin avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liver's Issues

small documentation in the rebar3 configuration issue

{deps, [
  {liver, ".*",
      {git, "https://github.com/erlangbureau/liver.git", {branch, 0.9.0}}
  }
]}.

it should be

{deps, [
  {liver, ".*",
      {git, "https://github.com/erlangbureau/liver.git", {branch, "0.9.0"}}
  }
]}.

Missing quotes around the branch version number.

Support for unicode characters

Is liver supporting unicode characters ?
I have made a simple test which shows there might be an issue in the validators when unicode characters are used.

Example:

11> Schema1 = [{<<"first_name">>,[{length_between,[4,6]}]}].
[{<<"first_name">>,[{length_between,[4,6]}]}]
12> Input5 = [{<<"first_name">>,<<"Grego">>}].
[{<<"first_name">>,<<"Grego">>}]
13> liver:validate(Schema1, Input5).          
{ok,[{<<"first_name">>,<<"Grego">>}]}
14> Input6 = [{<<"first_name">>,<<"Grégo">>}].
[{<<"first_name">>,<<"Grégo">>}]
15> liver:validate(Schema1, Input6).          
{error,[{<<"first_name">>,<<"FORMAT_ERROR">>}]}

The only difference between Input5 and Input6 is the é character used in the first_name of Input6 compared to the first_name of Input5.

Or maybe I'm doing something wrong (I'm rather new to erlang). In this case, sorry for bothering you.

Can't validate boolean

Hi,
I'm trying to validate a boolean input like this:

liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"false">>}]).
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, 1}])
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"0">>}]).
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"false">>}], [{strict, true}]).
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"off">>}], [{strict, true}]).

but the result is invariably:

{error,[{<<"test">>,not_boolean}]}

Am I doing something wrong?

rebar3 compatibility

Hi at all,
I'm trying to use liver in my rebar3 project.
I made a commit to make the project compatible with rebar3.
If you are interested, we can work together to integrate in your repo. 😄

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.