Added typespecs on all exported functions
Made sure all exported types do have a typespec is useful in build scenarios where the erlang compile options [warnings_as_errors, warn_missing_spec] are used. A few type errors found by Dialyzer are corrected too. modified: src/jsx.erl modified: src/jsx_config.erl modified: src/jsx_config.hrl modified: src/jsx_decoder.erl modified: src/jsx_parser.erl modified: src/jsx_to_json.erl modified: src/jsx_to_term.erl modified: src/jsx_verify.erl
This commit is contained in:
parent
a39baa4efc
commit
2943116c08
8 changed files with 48 additions and 10 deletions
13
src/jsx.erl
13
src/jsx.erl
|
@ -63,8 +63,14 @@ encode(Source, Config) -> jsx_to_json:to_json(Source, Config).
|
|||
|
||||
%% old api, alias for encode/x
|
||||
|
||||
-spec to_json(Source::json_term()) -> json_text() | {incomplete, encoder()}.
|
||||
-spec to_json(Source::json_term(), Config::jsx_to_json:config()) -> json_text() | {incomplete, encoder()}.
|
||||
|
||||
to_json(Source) -> encode(Source, []).
|
||||
to_json(Source, Config) -> encode(Source, Config).
|
||||
|
||||
-spec term_to_json(Source::json_term()) -> json_text() | {incomplete, encoder()}.
|
||||
-spec term_to_json(Source::json_term(), Config::jsx_to_json:config()) -> json_text() | {incomplete, encoder()}.
|
||||
term_to_json(Source) -> encode(Source, []).
|
||||
term_to_json(Source, Config) -> encode(Source, Config).
|
||||
|
||||
|
@ -94,8 +100,15 @@ decode(Source, Config) -> jsx_to_term:to_term(Source, Config).
|
|||
|
||||
%% old api, alias for to_term/x
|
||||
|
||||
-spec to_term(Source::json_text()) -> json_term() | {incomplete, decoder()}.
|
||||
-spec to_term(Source::json_text(), Config::jsx_to_term:config()) -> json_term() | {incomplete, decoder()}.
|
||||
|
||||
to_term(Source) -> decode(Source, []).
|
||||
to_term(Source, Config) -> decode(Source, Config).
|
||||
|
||||
-spec json_to_term(Source::json_text()) -> json_term() | {incomplete, decoder()}.
|
||||
-spec json_to_term(Source::json_text(), Config::jsx_to_term:config()) -> json_term() | {incomplete, decoder()}.
|
||||
|
||||
json_to_term(Source) -> decode(Source, []).
|
||||
json_to_term(Source, Config) -> decode(Source, Config).
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue