Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
andreineculau committed May 20, 2017
1 parent d71b0a2 commit fb87e9f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions src/jesse_state.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
%% Includes
-include("jesse_schema_validator.hrl").

-type extra_validator() :: fun((jesse:json_term(), state()) -> state()) | undefined.
%% Internal datastructures
-record( state
, { root_schema :: jesse:json_term()
Expand All @@ -75,6 +74,9 @@
}
).

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

-opaque state() :: #state{}.

%%% API
Expand Down Expand Up @@ -393,4 +395,6 @@ load_schema(#state{schema_loader_fun = LoaderFun}, SchemaURI) ->
?not_found
end.

get_extra_validator(#state{extra_validator=Fun}) -> Fun.
%% @private
get_extra_validator(#state{extra_validator = Fun}) ->
Fun.
8 changes: 4 additions & 4 deletions src/jesse_validator_draft3.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ remove_last_from_path(State) ->

%% @private
check_external_validation(Value, State) ->
case jesse_state:get_extra_validator(State) of
undefined -> State;
Fun -> Fun(Value, State)
end.
case jesse_state:get_extra_validator(State) of
undefined -> State;
Fun -> Fun(Value, State)
end.
8 changes: 4 additions & 4 deletions src/jesse_validator_draft4.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ valid_datetime(DateTimeBin) ->
end.

check_external_validation(Value, State) ->
case jesse_state:get_extra_validator(State) of
undefined -> State;
Fun -> Fun(Value, State)
end.
case jesse_state:get_extra_validator(State) of
undefined -> State;
Fun -> Fun(Value, State)
end.

0 comments on commit fb87e9f

Please sign in to comment.