refactor(authn/authz_http_schema): use typerefl alias
This commit is contained in:
parent
3e2ce57cb1
commit
b24b66081a
|
@ -54,7 +54,7 @@ t_check_schema(_Config) ->
|
||||||
?assertThrow(
|
?assertThrow(
|
||||||
#{
|
#{
|
||||||
path := "authentication.1.password_hash_algorithm.name",
|
path := "authentication.1.password_hash_algorithm.name",
|
||||||
matched_type := "builtin_db/authn-hash:simple",
|
matched_type := "authn:builtin_db/authn-hash:simple",
|
||||||
reason := unable_to_convert_to_enum_symbol
|
reason := unable_to_convert_to_enum_symbol
|
||||||
},
|
},
|
||||||
Check(ConfigNotOk)
|
Check(ConfigNotOk)
|
||||||
|
@ -73,7 +73,7 @@ t_check_schema(_Config) ->
|
||||||
#{
|
#{
|
||||||
path := "authentication.1.password_hash_algorithm",
|
path := "authentication.1.password_hash_algorithm",
|
||||||
reason := "algorithm_name_missing",
|
reason := "algorithm_name_missing",
|
||||||
matched_type := "builtin_db"
|
matched_type := "authn:builtin_db"
|
||||||
},
|
},
|
||||||
Check(ConfigMissingAlgoName)
|
Check(ConfigMissingAlgoName)
|
||||||
).
|
).
|
||||||
|
|
|
@ -100,7 +100,7 @@ common_fields() ->
|
||||||
{backend, emqx_authn_schema:backend(?AUTHN_BACKEND)},
|
{backend, emqx_authn_schema:backend(?AUTHN_BACKEND)},
|
||||||
{url, fun url/1},
|
{url, fun url/1},
|
||||||
{body,
|
{body,
|
||||||
hoconsc:mk(map([{fuzzy, term(), binary()}]), #{
|
hoconsc:mk(typerefl:alias("map", map([{fuzzy, term(), binary()}])), #{
|
||||||
required => false, desc => ?DESC(body)
|
required => false, desc => ?DESC(body)
|
||||||
})},
|
})},
|
||||||
{request_timeout, fun request_timeout/1}
|
{request_timeout, fun request_timeout/1}
|
||||||
|
|
|
@ -99,7 +99,7 @@ http_common_fields() ->
|
||||||
mk_duration("Request timeout", #{
|
mk_duration("Request timeout", #{
|
||||||
required => false, default => <<"30s">>, desc => ?DESC(request_timeout)
|
required => false, default => <<"30s">>, desc => ?DESC(request_timeout)
|
||||||
})},
|
})},
|
||||||
{body, ?HOCON(map(), #{required => false, desc => ?DESC(body)})}
|
{body, ?HOCON(hoconsc:map(name, binary()), #{required => false, desc => ?DESC(body)})}
|
||||||
] ++
|
] ++
|
||||||
lists:keydelete(
|
lists:keydelete(
|
||||||
pool_type,
|
pool_type,
|
||||||
|
@ -108,7 +108,7 @@ http_common_fields() ->
|
||||||
).
|
).
|
||||||
|
|
||||||
headers(type) ->
|
headers(type) ->
|
||||||
list({binary(), binary()});
|
typerefl:alias("map", list({binary(), binary()}));
|
||||||
headers(desc) ->
|
headers(desc) ->
|
||||||
?DESC(?FUNCTION_NAME);
|
?DESC(?FUNCTION_NAME);
|
||||||
headers(converter) ->
|
headers(converter) ->
|
||||||
|
@ -121,7 +121,7 @@ headers(_) ->
|
||||||
undefined.
|
undefined.
|
||||||
|
|
||||||
headers_no_content_type(type) ->
|
headers_no_content_type(type) ->
|
||||||
list({binary(), binary()});
|
typerefl:alias("map", list({binary(), binary()}));
|
||||||
headers_no_content_type(desc) ->
|
headers_no_content_type(desc) ->
|
||||||
?DESC(?FUNCTION_NAME);
|
?DESC(?FUNCTION_NAME);
|
||||||
headers_no_content_type(converter) ->
|
headers_no_content_type(converter) ->
|
||||||
|
|
Loading…
Reference in New Issue