Skip to content

Commit

Permalink
Merge pull request #18 from egobrain/patch-1
Browse files Browse the repository at this point in the history
Fixed jesse:validate spec
  • Loading branch information
andreineculau committed Apr 7, 2016
2 parents b7789ea + f2b5ed5 commit 7b63e6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jesse.erl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ load_schemas(Path, ParserFun, ValidationFun, MakeKeyFun) ->
-spec validate( Schema :: any()
, Data :: json_term() | binary()
) -> {ok, json_term()}
| jesse_error:error().
| jesse_error:error()
| jesse_database:error().
validate(Schema, Data) ->
validate(Schema, Data, []).

Expand All @@ -142,7 +143,8 @@ validate(Schema, Data) ->
, Data :: json_term() | binary()
, Options :: [{Key :: atom(), Data :: any()}]
) -> {ok, json_term()}
| jesse_error:error().
| jesse_error:error()
| jesse_database:error().
validate(Schema, Data, Options) ->
try
ParserFun = proplists:get_value(parser_fun, Options, fun(X) -> X end),
Expand Down
8 changes: 8 additions & 0 deletions src/jesse_database.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@
]).

-export_type([ update_result/0
, error/0
]).

-type update_result() :: ok | [fail()].

-type error() :: {error, error_reason()}.

-type error_reason() :: { 'database_error'
, Key ::any()
, 'schema_not_found'
}.

-type fail() :: {file:filename(), file:date_time(), reason()}.
-type reason() :: term().

Expand Down

0 comments on commit 7b63e6f

Please sign in to comment.