Browse Source

feat: upgrade hocon to 0.40.0 which supports union type display name

Zaiming (Stone) Shi 2 years ago
parent
commit
86110824eb

+ 1 - 1
apps/emqx/rebar.config

@@ -30,7 +30,7 @@
     {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.7"}}},
     {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.15.16"}}},
     {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.2.1"}}},
-    {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.39.19"}}},
+    {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.40.0"}}},
     {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.3"}}},
     {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}},
     {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}},

+ 1 - 1
apps/emqx/src/emqx_schema.erl

@@ -3316,7 +3316,7 @@ get_tombstone_map_value_type(Schema) ->
     %% hoconsc:map_value_type(Schema)
     ?MAP(_Name, Union) = hocon_schema:field_schema(Schema, type),
     %% TODO: violation of abstraction, fix hoconsc:union_members/1
-    ?UNION(Members) = Union,
+    ?UNION(Members, _) = Union,
     Tombstone = tombstone(),
     [Type, Tombstone] = hoconsc:union_members(Members),
     Type.

+ 2 - 2
apps/emqx_auth/src/emqx_authz/emqx_authz_schema.erl

@@ -136,7 +136,7 @@ authz_fields() ->
     [
         {sources,
             ?HOCON(
-                ?ARRAY(?UNION(UnionMemberSelector)),
+                ?ARRAY(hoconsc:union(UnionMemberSelector)),
                 #{
                     default => [default_authz()],
                     desc => ?DESC(sources),
@@ -153,7 +153,7 @@ api_authz_fields() ->
     [{sources, ?HOCON(?ARRAY(api_source_type()), #{desc => ?DESC(sources)})}].
 
 api_source_type() ->
-    ?UNION(api_authz_refs()).
+    hoconsc:union(api_authz_refs()).
 
 api_authz_refs() ->
     lists:concat([api_source_refs(Mod) || Mod <- source_schema_mods()]).

+ 0 - 1
apps/emqx_auth/test/emqx_authn/emqx_authn_chains_SUITE.erl

@@ -16,7 +16,6 @@
 
 -module(emqx_authn_chains_SUITE).
 
--behaviour(hocon_schema).
 -behaviour(emqx_authn_provider).
 
 -compile(export_all).

+ 1 - 1
apps/emqx_conf/src/emqx_conf.erl

@@ -292,7 +292,7 @@ hocon_schema_to_spec(?MAP(Name, Type), LocalModule) ->
         },
         SubRefs
     };
-hocon_schema_to_spec(?UNION(Types), LocalModule) ->
+hocon_schema_to_spec(?UNION(Types, _DisplayName), LocalModule) ->
     {OneOf, Refs} = lists:foldl(
         fun(Type, {Acc, RefsAcc}) ->
             {Schema, SubRefs} = hocon_schema_to_spec(Type, LocalModule),

+ 1 - 1
apps/emqx_conf/src/emqx_conf_schema.erl

@@ -978,7 +978,7 @@ fields("log") ->
             })},
         {"file",
             sc(
-                ?UNION([
+                hoconsc:union([
                     ?R_REF("log_file_handler"),
                     ?MAP(handler_name, ?R_REF("log_file_handler"))
                 ]),

+ 1 - 1
apps/emqx_dashboard/src/emqx_dashboard_swagger.erl

@@ -776,7 +776,7 @@ hocon_schema_to_spec(?MAP(Name, Type), LocalModule) ->
         },
         SubRefs
     };
-hocon_schema_to_spec(?UNION(Types), LocalModule) ->
+hocon_schema_to_spec(?UNION(Types, _DisplayName), LocalModule) ->
     {OneOf, Refs} = lists:foldl(
         fun(Type, {Acc, RefsAcc}) ->
             {Schema, SubRefs} = hocon_schema_to_spec(Type, LocalModule),

+ 1 - 1
apps/emqx_management/src/emqx_mgmt_api_listeners.erl

@@ -313,7 +313,7 @@ create_listener_schema(Opts) ->
     ],
     Example = maps:remove(id, tcp_schema_example()),
     emqx_dashboard_swagger:schema_with_example(
-        ?UNION(Schemas),
+        hoconsc:union(Schemas),
         Example#{name => <<"demo">>}
     ).
 

+ 1 - 1
apps/emqx_rule_engine/src/emqx_rule_engine_schema.erl

@@ -262,7 +262,7 @@ actions() ->
     end.
 
 qos() ->
-    ?UNION([emqx_schema:qos(), binary()]).
+    hoconsc:union([emqx_schema:qos(), binary()]).
 
 rule_engine_settings() ->
     [

+ 1 - 1
mix.exs

@@ -72,7 +72,7 @@ defmodule EMQXUmbrella.MixProject do
       # in conflict by emqtt and hocon
       {:getopt, "1.0.2", override: true},
       {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "1.0.8", override: true},
-      {:hocon, github: "emqx/hocon", tag: "0.39.19", override: true},
+      {:hocon, github: "emqx/hocon", tag: "0.40.0", override: true},
       {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.5.3", override: true},
       {:esasl, github: "emqx/esasl", tag: "0.2.0"},
       {:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},

+ 1 - 1
rebar.config

@@ -75,7 +75,7 @@
     , {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}
     , {getopt, "1.0.2"}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "1.0.8"}}}
-    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.39.19"}}}
+    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.40.0"}}}
     , {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.3"}}}
     , {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
     , {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}