Skip to content

Commit

Permalink
Fix doc generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sylane committed Nov 14, 2024
1 parent 56de5ee commit ac82070
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

{hex, [{doc, #{provider => ex_doc}}]}.

{edoc_opts, [{preprocess, true}]}.

{ex_doc, [
{extras, [
{"CHANGELOG.md", #{title => "Changelog"}},
Expand Down
22 changes: 11 additions & 11 deletions src/grisp_connect_jsonrpc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@

%% @doc Decode a JSONRpc text packet and returns a list of decoded messages.
%% If some decoding errors occure while doing do, a special error message with
%% the tag `decoding_error` that can be encoded and sent back directly to the
%% the tag `decoding_error' that can be encoded and sent back directly to the
%% JSONRpc peer.
%%
%% During JSON decoding, the `null` values are changed to `undefined` and when
%% encoding, `undefined` values are changed back to `null`.
%% During JSON decoding, the `null' values are changed to `undefined' and when
%% encoding, `undefined' values are changed back to `null'.
%%
%% The `method` will <b>always</b> be a binary, and `id` will always be either
%% The `method' will <b>always</b> be a binary, and `id' will always be either
%% a binary or an integer.
%%
%% <p>The possible decoded messages are:
%% <ul>
%% <li><b><c>{request, Method :: binary(), Params :: map() | list(), ReqRef :: binary() | integer()}</c></b></li>
%% <li><b><c>{result, Result :: term(), ReqRef :: binary()}</c></b></li>
%% <li><b><c>{notification, Method :: binary(), Params :: map() | list()}</c></b></li>
%% <li><b><c>{error, Code :: integer(), Message :: undefined | binary(), Data :: undefined | term(), ReqRef :: undefined | binary() | integer()}</c></b></li>
%% <li><b><c>{decoding_error, Code :: integer(), Message :: undefined | binary(), Data :: undefined | term(), ReqRef :: undefined | binary() | integer()}</c></b></li>
%% </ul>
%% <li><b>`{request, Method :: binary(), Params :: map() | list(), ReqRef :: binary() | integer()}'</b></li>
%% <li><b>`{result, Result :: term(), ReqRef :: binary()}'</b></li>
%% <li><b>`{notification, Method :: binary(), Params :: map() | list()}'</b></li>
%% <li><b>`{error, Code :: integer(), Message :: undefined | binary(), Data :: undefined | term(), ReqRef :: undefined | binary() | integer()}'</b></li>
%% <li><b>`{decoding_error, Code :: integer(), Message :: undefined | binary(), Data :: undefined | term(), ReqRef :: undefined | binary() | integer()}'</b></li>
%% </ul></p>
-spec decode(Data :: iodata()) -> [json_rpc_message()].
decode(Data) ->
case json_to_term(iolist_to_binary(Data)) of
Expand All @@ -71,7 +71,7 @@ decode(Data) ->
end.

%% @doc Encode a JSONRpc message or a list of JSONRpc messages to JSON text.
%% For backward compatibility, the `method` can be an atom.
%% For backward compatibility, the `method' can be an atom.
-spec encode(Messages :: json_rpc_message() | [json_rpc_message()]) -> iodata().
encode(Messages) when is_list(Messages) ->
term_to_json([pack(M) || M <- Messages]);
Expand Down

0 comments on commit ac82070

Please sign in to comment.