feat: Add API endpoint /api/v5/schemas/bridges_v2
This commit is contained in:
parent
4ac0a76d00
commit
36411edb42
|
@ -14,7 +14,11 @@
|
||||||
%% limitations under the License.
|
%% limitations under the License.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
%% This module is for dashboard to retrieve the schema hot config and bridges.
|
%% This module is for dashboard to retrieve the schema of
|
||||||
|
%% 1. hot-config
|
||||||
|
%% 2. bridge
|
||||||
|
%% 3. bridge_v2
|
||||||
|
%% 4. connector
|
||||||
-module(emqx_dashboard_schema_api).
|
-module(emqx_dashboard_schema_api).
|
||||||
|
|
||||||
-behaviour(minirest_api).
|
-behaviour(minirest_api).
|
||||||
|
@ -45,7 +49,7 @@ schema("/schemas/:name") ->
|
||||||
'operationId' => get_schema,
|
'operationId' => get_schema,
|
||||||
get => #{
|
get => #{
|
||||||
parameters => [
|
parameters => [
|
||||||
{name, hoconsc:mk(hoconsc:enum([hotconf, bridges]), #{in => path})}
|
{name, hoconsc:mk(hoconsc:enum([hotconf, bridges, bridges_v2]), #{in => path})}
|
||||||
],
|
],
|
||||||
desc => <<
|
desc => <<
|
||||||
"Get the schema JSON of the specified name. "
|
"Get the schema JSON of the specified name. "
|
||||||
|
@ -73,4 +77,17 @@ get_schema(get, _) ->
|
||||||
gen_schema(hotconf) ->
|
gen_schema(hotconf) ->
|
||||||
emqx_conf:hotconf_schema_json();
|
emqx_conf:hotconf_schema_json();
|
||||||
gen_schema(bridges) ->
|
gen_schema(bridges) ->
|
||||||
emqx_conf:bridge_schema_json().
|
emqx_conf:bridge_schema_json();
|
||||||
|
gen_schema(bridges_v2) ->
|
||||||
|
bridge_v2_schema_json().
|
||||||
|
|
||||||
|
bridge_v2_schema_json() ->
|
||||||
|
SchemaInfo = #{title => <<"EMQX Data Bridge V2 API Schema">>, version => <<"0.1.0">>},
|
||||||
|
gen_api_schema_json_iodata(emqx_bridge_v2_api, SchemaInfo).
|
||||||
|
|
||||||
|
gen_api_schema_json_iodata(SchemaMod, SchemaInfo) ->
|
||||||
|
emqx_dashboard_swagger:gen_api_schema_json_iodata(
|
||||||
|
SchemaMod,
|
||||||
|
SchemaInfo,
|
||||||
|
fun emqx_conf:hocon_schema_to_spec/2
|
||||||
|
).
|
||||||
|
|
Loading…
Reference in New Issue