chore(gw): make some fields required

This commit is contained in:
JianBo He 2021-12-22 16:22:09 +08:00
parent 6d4aac1600
commit 1bcdbf3a06
1 changed files with 16 additions and 5 deletions

View File

@ -118,6 +118,7 @@ fields(mqttsn) ->
[ {gateway_id, [ {gateway_id,
sc(integer(), sc(integer(),
#{ default => 1 #{ default => 1
, nullable => false
, desc => , desc =>
"MQTT-SN Gateway Id.<br> "MQTT-SN Gateway Id.<br>
When the <code>broadcast</code> option is enabled, When the <code>broadcast</code> option is enabled,
@ -142,6 +143,7 @@ The client just sends its PUBLISH messages to a GW"
, {predefined, , {predefined,
sc(hoconsc:array(ref(mqttsn_predefined)), sc(hoconsc:array(ref(mqttsn_predefined)),
#{ default => [] #{ default => []
, nullable => {true, recursively}
, desc => , desc =>
<<"The Pre-defined topic ids and topic names.<br> <<"The Pre-defined topic ids and topic names.<br>
A 'pre-defined' topic id is a topic id whose mapping to a topic name A 'pre-defined' topic id is a topic id whose mapping to a topic name
@ -217,6 +219,7 @@ fields(lwm2m) ->
[ {xml_dir, [ {xml_dir,
sc(binary(), sc(binary(),
#{ default =>"etc/lwm2m_xml" #{ default =>"etc/lwm2m_xml"
, nullable => false
, desc => "The Directory for LwM2M Resource defination" , desc => "The Directory for LwM2M Resource defination"
})} })}
, {lifetime_min, , {lifetime_min,
@ -265,18 +268,21 @@ beyond this time window are temporarily stored in memory."
fields(exproto) -> fields(exproto) ->
[ {server, [ {server,
sc(ref(exproto_grpc_server), sc(ref(exproto_grpc_server),
#{ desc => "Configurations for starting the <code>ConnectionAdapter</code> service" #{ nullable => false
, desc => "Configurations for starting the <code>ConnectionAdapter</code> service"
})} })}
, {handler, , {handler,
sc(ref(exproto_grpc_handler), sc(ref(exproto_grpc_handler),
#{ desc => "Configurations for request to <code>ConnectionHandler</code> service" #{ nullable => false
, desc => "Configurations for request to <code>ConnectionHandler</code> service"
})} })}
, {listeners, sc(ref(udp_tcp_listeners))} , {listeners, sc(ref(udp_tcp_listeners))}
] ++ gateway_common_options(); ] ++ gateway_common_options();
fields(exproto_grpc_server) -> fields(exproto_grpc_server) ->
[ {bind, [ {bind,
sc(hoconsc:union([ip_port(), integer()]))} sc(hoconsc:union([ip_port(), integer()]),
#{nullable => false})}
, {ssl, , {ssl,
sc(ref(ssl_server_opts), sc(ref(ssl_server_opts),
#{ nullable => {true, recursively} #{ nullable => {true, recursively}
@ -284,7 +290,7 @@ fields(exproto_grpc_server) ->
]; ];
fields(exproto_grpc_handler) -> fields(exproto_grpc_handler) ->
[ {address, sc(binary())} [ {address, sc(binary(), #{nullable => false})}
, {ssl, , {ssl,
sc(ref(ssl_client_opts), sc(ref(ssl_client_opts),
#{ nullable => {true, recursively} #{ nullable => {true, recursively}
@ -316,11 +322,13 @@ fields(lwm2m_translators) ->
For each new LwM2M client that succeeds in going online, the gateway creates For each new LwM2M client that succeeds in going online, the gateway creates
a the subscription relationship to receive downstream commands and send it to a the subscription relationship to receive downstream commands and send it to
the LwM2M client" the LwM2M client"
, nullable => false
})} })}
, {response, , {response,
sc(ref(translator), sc(ref(translator),
#{ desc => #{ desc =>
"The topic for gateway to publish the acknowledge events from LwM2M client" "The topic for gateway to publish the acknowledge events from LwM2M client"
, nullable => false
})} })}
, {notify, , {notify,
sc(ref(translator), sc(ref(translator),
@ -328,21 +336,24 @@ the LwM2M client"
"The topic for gateway to publish the notify events from LwM2M client.<br> "The topic for gateway to publish the notify events from LwM2M client.<br>
After succeed observe a resource of LwM2M client, Gateway will send the After succeed observe a resource of LwM2M client, Gateway will send the
notifyevents via this topic, if the client reports any resource changes" notifyevents via this topic, if the client reports any resource changes"
, nullable => false
})} })}
, {register, , {register,
sc(ref(translator), sc(ref(translator),
#{ desc => #{ desc =>
"The topic for gateway to publish the register events from LwM2M client.<br>" "The topic for gateway to publish the register events from LwM2M client.<br>"
, nullable => false
})} })}
, {update, , {update,
sc(ref(translator), sc(ref(translator),
#{ desc => #{ desc =>
"The topic for gateway to publish the update events from LwM2M client.<br>" "The topic for gateway to publish the update events from LwM2M client.<br>"
, nullable => false
})} })}
]; ];
fields(translator) -> fields(translator) ->
[ {topic, sc(binary())} [ {topic, sc(binary(), #{nullable => false})}
, {qos, sc(range(0, 2), #{default => 0})} , {qos, sc(range(0, 2), #{default => 0})}
]; ];