From f80903b3f5ec174bf02b3abecd2a1fcc13dc9f88 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Fri, 9 Feb 2018 23:59:30 +0000 Subject: [PATCH 1/2] Update -spec(). for proper module readibility Handle "Invalid type specification" --- src/jsx_consult.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsx_consult.erl b/src/jsx_consult.erl index 2b0f1da..b1a4424 100644 --- a/src/jsx_consult.erl +++ b/src/jsx_consult.erl @@ -80,7 +80,7 @@ consult(File, Config) when is_list(Config) -> end. --type state() :: {list(), #config{}}. +-type state() :: {[], proplists:proplist(), {list(), #config{}}}. -spec init(Config::proplists:proplist()) -> state(). init(Config) -> {[], Config, jsx_to_term:start_term(Config)}. From a3b1a9dad938ec0ea777d119187e7bc7e4f55a95 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 10 Feb 2018 00:04:14 +0000 Subject: [PATCH 2/2] Allow -spec(). to reflect what's really going on Handle "Invalid type specification" --- src/jsx_verify.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jsx_verify.erl b/src/jsx_verify.erl index 2073b99..5f4a3d8 100644 --- a/src/jsx_verify.erl +++ b/src/jsx_verify.erl @@ -27,7 +27,7 @@ -export([init/1, handle_event/2]). --spec is_json(Source::binary(), Config::jsx_config:config()) -> true | false | {incomplete, jsx:decoder()}. +-spec is_json(Source::binary(), Config::proplists:proplist()) -> true | false | {incomplete, jsx:decoder()}. is_json(Source, Config) when is_list(Config) -> try (jsx:decoder(?MODULE, Config, jsx_config:extract_config(Config)))(Source) @@ -35,7 +35,7 @@ is_json(Source, Config) when is_list(Config) -> end. --spec is_term(Source::any(), Config::jsx_config:config()) -> true | false | {incomplete, jsx:encoder()}. +-spec is_term(Source::any(), Config::proplists:proplist()) -> true | false | {incomplete, jsx:encoder()}. is_term(Source, Config) when is_list(Config) -> try (jsx:encoder(?MODULE, Config, jsx_config:extract_config(Config)))(Source)