Skip to content

Commit 89a8737

Browse files
committed
refactor: module attribute to store the name of the default JSON library
1 parent 2f7435f commit 89a8737

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/protox/define_message.ex

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
defmodule Protox.DefineMessage do
22
@moduledoc false
33

4+
@default_json_library Jason
5+
46
alias Protox.Field
57

68
def define(messages, opts \\ []) do
79
keep_unknown_fields = Keyword.get(opts, :keep_unknown_fields, true)
8-
json_library = Keyword.get(opts, :json_library, Jason)
10+
json_library = Keyword.get(opts, :json_library, @default_json_library)
911

1012
for msg = %Protox.Message{} <- messages do
1113
fields = Enum.sort(msg.fields, &(&1.tag < &2.tag))

0 commit comments

Comments
 (0)