-
Notifications
You must be signed in to change notification settings - Fork 64
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
validator #51
Conversation
src/jesse_state.erl
Outdated
@@ -49,12 +52,16 @@ | |||
%% Includes | |||
-include("jesse_schema_validator.hrl"). | |||
|
|||
-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined. |
There was a problem hiding this comment.
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..
src/jesse_state.erl
Outdated
@@ -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. |
There was a problem hiding this comment.
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..
src/jesse_state.erl
Outdated
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 |
There was a problem hiding this comment.
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
126cbdf
to
d71b0a2
Compare
src/jesse_state.erl
Outdated
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 |
There was a problem hiding this comment.
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
src/jesse_state.erl
Outdated
@@ -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. |
There was a problem hiding this comment.
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..
src/jesse_state.erl
Outdated
@@ -49,12 +52,16 @@ | |||
%% Includes | |||
-include("jesse_schema_validator.hrl"). | |||
|
|||
-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined. |
There was a problem hiding this comment.
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..
src/jesse_state.erl
Outdated
@@ -26,6 +26,7 @@ | |||
%% API | |||
-export([ add_to_path/2 | |||
, get_allowed_errors/1 | |||
, get_extra_validator/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra/external
src/jesse_validator_draft3.erl
Outdated
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe_check_external_validation
src/jesse_validator_draft3.erl
Outdated
@@ -48,7 +48,8 @@ | |||
| ?not_in_range | |||
| ?wrong_length | |||
| ?wrong_size | |||
| ?wrong_type. | |||
| ?wrong_type | |||
| ?external_error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
external
fb87e9f
to
e7cabcd
Compare
this will extra validations for schema elements example : lookup some value in a database an provide an error
e7cabcd
to
07bafff
Compare
subset of @lazedo 's #42