Open koorchik opened 7 years ago
There are two methods init(JSONObject rules)
and
init(String rules)
.
If string value is not valid json object you'll get FormatError like in base js implementation.
Depends on necessity you can verify if object is valid before Livr usage.
Oh, it would be great to have a alternative example (with Json builder) in docs
I guess, It makes sense to make the validator more abstract. So, it will take JsonObject and will return JsonObject. In this case it will be more flexible and you can be sure that there are no mistakes in JSONsytax.
or with JSON builder
Moreover, direct string support can be added with a simple wrapper. Besides that we allow users to create own builders.