feat(http): add `is_template` as HTTP headers field property
is_template was designed to be type property. however for HTTP headers, it's a map() type, instead of creating a new type for it, it's easier to just add it as a field property.
This commit is contained in:
parent
ede4eeae9f
commit
5b38d592f0
|
@ -130,7 +130,8 @@ fields("request") ->
|
|||
})},
|
||||
{path, hoconsc:mk(emqx_schema:template(), #{required => false, desc => ?DESC("path")})},
|
||||
{body, hoconsc:mk(emqx_schema:template(), #{required => false, desc => ?DESC("body")})},
|
||||
{headers, hoconsc:mk(map(), #{required => false, desc => ?DESC("headers")})},
|
||||
{headers,
|
||||
hoconsc:mk(map(), #{required => false, desc => ?DESC("headers"), is_template => true})},
|
||||
{max_retries,
|
||||
sc(
|
||||
non_neg_integer(),
|
||||
|
|
|
@ -270,7 +270,8 @@ headers_field() ->
|
|||
<<"content-type">> => <<"application/json">>,
|
||||
<<"keep-alive">> => <<"timeout=5">>
|
||||
},
|
||||
desc => ?DESC("config_headers")
|
||||
desc => ?DESC("config_headers"),
|
||||
is_template => true
|
||||
}
|
||||
)}.
|
||||
|
||||
|
|
|
@ -57,7 +57,11 @@
|
|||
allowEmptyValue,
|
||||
deprecated,
|
||||
minimum,
|
||||
maximum
|
||||
maximum,
|
||||
%% is_template is a type property,
|
||||
%% but some exceptions are made for them to be field property
|
||||
%% for example, HTTP headers (which is a map type)
|
||||
is_template
|
||||
]).
|
||||
|
||||
-define(INIT_SCHEMA, #{
|
||||
|
|
Loading…
Reference in New Issue