chore(schema): use emqx_schema:qos() instead of union integer.
This commit is contained in:
parent
97e22cc6a8
commit
f5415589e9
|
@ -35,12 +35,10 @@ fields("auto_subscribe") ->
|
||||||
|
|
||||||
fields("topic") ->
|
fields("topic") ->
|
||||||
[ {topic, sc(binary(), #{example => topic_example()})}
|
[ {topic, sc(binary(), #{example => topic_example()})}
|
||||||
, {qos, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
|
, {qos, sc(emqx_schema:qos(), #{default => 0})}
|
||||||
#{default => 0})}
|
, {rh, sc(range(0,2), #{default => 0})}
|
||||||
, {rh, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
|
, {rap, sc(range(0, 1), #{default => 0})}
|
||||||
#{default => 0})}
|
, {nl, sc(range(0, 1), #{default => 0})}
|
||||||
, {rap, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
|
|
||||||
, {nl, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
|
|
||||||
].
|
].
|
||||||
|
|
||||||
topic_example() ->
|
topic_example() ->
|
||||||
|
|
|
@ -236,7 +236,7 @@ Template with variables is allowed."""
|
||||||
].
|
].
|
||||||
|
|
||||||
qos() ->
|
qos() ->
|
||||||
hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2), binary()]).
|
hoconsc:union([emqx_schema:qos(), binary()]).
|
||||||
|
|
||||||
sc(Type, Meta) -> hoconsc:mk(Type, Meta).
|
sc(Type, Meta) -> hoconsc:mk(Type, Meta).
|
||||||
ref(Field) -> hoconsc:ref(?MODULE, Field).
|
ref(Field) -> hoconsc:ref(?MODULE, Field).
|
||||||
|
|
|
@ -189,7 +189,7 @@ The type of delivered coap message can be set to:<br>
|
||||||
3. qos: Mapping from QoS type of received message, QoS0 -> non, QoS1,2 -> con"
|
3. qos: Mapping from QoS type of received message, QoS0 -> non, QoS1,2 -> con"
|
||||||
})}
|
})}
|
||||||
, {subscribe_qos,
|
, {subscribe_qos,
|
||||||
sc(hoconsc:union([qos0, qos1, qos2, coap]),
|
sc(hoconsc:enum([qos0, qos1, qos2, coap]),
|
||||||
#{ default => coap
|
#{ default => coap
|
||||||
, desc =>
|
, desc =>
|
||||||
"The Default QoS Level indicator for subscribe request.<br>
|
"The Default QoS Level indicator for subscribe request.<br>
|
||||||
|
@ -202,7 +202,7 @@ The indicator can be set to:
|
||||||
* qos1: If the subscribe request is confirmable"
|
* qos1: If the subscribe request is confirmable"
|
||||||
})}
|
})}
|
||||||
, {publish_qos,
|
, {publish_qos,
|
||||||
sc(hoconsc:union([qos0, qos1, qos2, coap]),
|
sc(hoconsc:enum([qos0, qos1, qos2, coap]),
|
||||||
#{ default => coap
|
#{ default => coap
|
||||||
, desc =>
|
, desc =>
|
||||||
"The Default QoS Level indicator for publish request.<br>
|
"The Default QoS Level indicator for publish request.<br>
|
||||||
|
@ -356,7 +356,7 @@ notifyevents via this topic, if the client reports any resource changes"
|
||||||
|
|
||||||
fields(translator) ->
|
fields(translator) ->
|
||||||
[ {topic, sc(binary(), #{nullable => false})}
|
[ {topic, sc(binary(), #{nullable => false})}
|
||||||
, {qos, sc(range(0, 2), #{default => 0})}
|
, {qos, sc(emqx_schema:qos(), #{default => 0})}
|
||||||
];
|
];
|
||||||
|
|
||||||
fields(udp_listeners) ->
|
fields(udp_listeners) ->
|
||||||
|
|
|
@ -207,8 +207,7 @@ fields("ctx_disconnected") ->
|
||||||
].
|
].
|
||||||
|
|
||||||
qos() ->
|
qos() ->
|
||||||
{"qos", sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
|
{"qos", sc(emqx_schema:qos(), #{desc => "The Message QoS"})}.
|
||||||
#{desc => "The Message QoS"})}.
|
|
||||||
|
|
||||||
rule_id() ->
|
rule_id() ->
|
||||||
{"id", sc(binary(),
|
{"id", sc(binary(),
|
||||||
|
|
|
@ -194,7 +194,7 @@ outputs() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
qos() ->
|
qos() ->
|
||||||
hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2), binary()]).
|
hoconsc:union([emqx_schema:qos(), binary()]).
|
||||||
|
|
||||||
validate_sql(Sql) ->
|
validate_sql(Sql) ->
|
||||||
case emqx_rule_sqlparser:parse(Sql) of
|
case emqx_rule_sqlparser:parse(Sql) of
|
||||||
|
|
|
@ -30,7 +30,7 @@ fields("slow_subs") ->
|
||||||
"publish is disabled if set to 0s."
|
"publish is disabled if set to 0s."
|
||||||
)}
|
)}
|
||||||
, {notice_qos,
|
, {notice_qos,
|
||||||
sc(range(0, 2),
|
sc(emqx_schema:qos(),
|
||||||
0,
|
0,
|
||||||
"QoS of notification message in notice topic")}
|
"QoS of notification message in notice topic")}
|
||||||
, {notice_batch_size,
|
, {notice_batch_size,
|
||||||
|
|
Loading…
Reference in New Issue