Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validator #51

Merged
merged 1 commit into from
May 21, 2017
Merged

validator #51

merged 1 commit into from
May 21, 2017

Conversation

andreineculau
Copy link
Member

subset of @lazedo 's #42

@@ -49,12 +52,16 @@
%% Includes
-include("jesse_schema_validator.hrl").

-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Elvis:

Line 55 is too long: -type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined..

@@ -49,12 +52,16 @@
%% Includes
-include("jesse_schema_validator.hrl").

-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined.
-type setter_fun() :: fun((jesse:json_path(), jesse:json_term(), jesse:json_term()) -> jesse:json_term()) | undefined.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Elvis:

Line 56 is too long: -type setter_fun() :: fun((jesse:json_path(), jesse:json_term(), jesse:json_term()) -> jesse:json_term()) | undefined..

set_value(#state{setter_fun=undefined}=State, _Path, _Value) -> State;
set_value(#state{current_value=undefined}=State, _Path, _Value) -> State;
set_value(#state{setter_fun=Setter
,current_value=Value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Elvis:

Missing space right "," on line 418

set_value(#state{setter_fun=undefined}=State, _Path, _Value) -> State;
set_value(#state{current_value=undefined}=State, _Path, _Value) -> State;
set_value(#state{setter_fun=Setter
,current_value=Value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Elvis:

Missing space right "," on line 418

@@ -49,12 +52,16 @@
%% Includes
-include("jesse_schema_validator.hrl").

-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined.
-type setter_fun() :: fun((jesse:json_path(), jesse:json_term(), jesse:json_term()) -> jesse:json_term()) | undefined.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Elvis:

Line 56 is too long: -type setter_fun() :: fun((jesse:json_path(), jesse:json_term(), jesse:json_term()) -> jesse:json_term()) | undefined..

@@ -49,12 +52,16 @@
%% Includes
-include("jesse_schema_validator.hrl").

-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Elvis:

Line 55 is too long: -type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined..

@andreineculau andreineculau mentioned this pull request May 20, 2017
@@ -26,6 +26,7 @@
%% API
-export([ add_to_path/2
, get_allowed_errors/1
, get_extra_validator/1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra/external

check_value(Value, [{?REF, RefSchemaURI} | Attrs], State) ->
NewState = validate_ref(Value, RefSchemaURI, State),
check_value(Value, Attrs, NewState);
check_value(Value, [], State) ->
check_external_validation(Value, State);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe_check_external_validation

@@ -48,7 +48,8 @@
| ?not_in_range
| ?wrong_length
| ?wrong_size
| ?wrong_type.
| ?wrong_type
| ?external_error.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

external

this will extra validations for schema elements
example : lookup some value in a database an provide an error
@andreineculau andreineculau merged commit 7865bfc into master May 21, 2017
andreineculau added a commit that referenced this pull request May 22, 2017
This reverts commit 7865bfc, reversing
changes made to ef226b2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants