Просмотр исходного кода

test(schema): delete stale reference to emqx_schema:file() type

Zaiming (Stone) Shi 2 лет назад
Родитель
Сommit
65efa2672e

+ 0 - 2
apps/emqx/src/emqx_schema.erl

@@ -47,7 +47,6 @@
 -type bytesize() :: integer().
 -type wordsize() :: bytesize().
 -type percent() :: float().
--type file() :: string().
 -type comma_separated_list() :: list(string()).
 -type comma_separated_binary() :: [binary()].
 -type comma_separated_atoms() :: [atom()].
@@ -151,7 +150,6 @@
     bytesize/0,
     wordsize/0,
     percent/0,
-    file/0,
     comma_separated_list/0,
     comma_separated_binary/0,
     ip_port/0,

+ 0 - 2
apps/emqx_conf/src/emqx_conf.erl

@@ -337,8 +337,6 @@ typename_to_spec("timeout_duration_ms()", _Mod) ->
     #{type => duration};
 typename_to_spec("percent()", _Mod) ->
     #{type => percent};
-typename_to_spec("file()", _Mod) ->
-    #{type => string};
 typename_to_spec("ip_port()", _Mod) ->
     #{type => ip_port};
 typename_to_spec("url()", _Mod) ->

+ 1 - 1
apps/emqx_dashboard/test/emqx_swagger_requestBody_SUITE.erl

@@ -816,7 +816,7 @@ to_schema(Body) ->
 fields(good_ref) ->
     [
         {'webhook-host', mk(emqx_schema:ip_port(), #{default => <<"127.0.0.1:80">>})},
-        {log_dir, mk(emqx_schema:file(), #{example => "var/log/emqx"})},
+        {log_dir, mk(string(), #{example => "var/log/emqx"})},
         {tag, mk(binary(), #{desc => <<"tag">>})}
     ];
 fields(nest_ref) ->

+ 5 - 5
apps/emqx_dashboard/test/emqx_swagger_response_SUITE.erl

@@ -344,10 +344,9 @@ t_complex_type(_Config) ->
                 enum := [random, hash], type := string
             }},
             {<<"timeout">>, #{
-                example := infinity,
                 <<"oneOf">> := [
-                    #{example := infinity, type := string},
-                    #{type := integer}
+                    #{example := _, type := string},
+                    #{enum := [infinity], type := string}
                 ]
             }},
             {<<"bytesize">>, #{
@@ -653,7 +652,8 @@ schema("/ref/complex_type") ->
                     {server, hoconsc:mk(emqx_schema:ip_port(), #{})},
                     {connect_timeout, hoconsc:mk(emqx_schema:timeout_duration(), #{})},
                     {pool_type, hoconsc:mk(hoconsc:enum([random, hash]), #{})},
-                    {timeout, hoconsc:mk(timeout(), #{})},
+                    {timeout,
+                        hoconsc:mk(hoconsc:union([infinity, emqx_schema:timeout_duration()]), #{})},
                     {bytesize, hoconsc:mk(emqx_schema:bytesize(), #{})},
                     {wordsize, hoconsc:mk(emqx_schema:wordsize(), #{})},
                     {maps, hoconsc:mk(map(), #{})},
@@ -687,7 +687,7 @@ to_schema(Object) ->
 fields(good_ref) ->
     [
         {'webhook-host', mk(emqx_schema:ip_port(), #{default => <<"127.0.0.1:80">>})},
-        {log_dir, mk(emqx_schema:file(), #{example => "var/log/emqx"})},
+        {log_dir, mk(string(), #{example => "var/log/emqx"})},
         {tag, mk(binary(), #{desc => <<"tag">>})}
     ];
 fields(nest_ref) ->