feat: Add API endpoint /api/v5/schemas/connectors
This commit is contained in:
parent
36411edb42
commit
3cab31261e
|
@ -45,11 +45,12 @@ paths() ->
|
||||||
|
|
||||||
%% This is a rather hidden API, so we don't need to add translations for the description.
|
%% This is a rather hidden API, so we don't need to add translations for the description.
|
||||||
schema("/schemas/:name") ->
|
schema("/schemas/:name") ->
|
||||||
|
Schemas = [hotconf, bridges, bridges_v2, connectors],
|
||||||
#{
|
#{
|
||||||
'operationId' => get_schema,
|
'operationId' => get_schema,
|
||||||
get => #{
|
get => #{
|
||||||
parameters => [
|
parameters => [
|
||||||
{name, hoconsc:mk(hoconsc:enum([hotconf, bridges, bridges_v2]), #{in => path})}
|
{name, hoconsc:mk(hoconsc:enum(Schemas), #{in => path})}
|
||||||
],
|
],
|
||||||
desc => <<
|
desc => <<
|
||||||
"Get the schema JSON of the specified name. "
|
"Get the schema JSON of the specified name. "
|
||||||
|
@ -79,12 +80,18 @@ gen_schema(hotconf) ->
|
||||||
gen_schema(bridges) ->
|
gen_schema(bridges) ->
|
||||||
emqx_conf:bridge_schema_json();
|
emqx_conf:bridge_schema_json();
|
||||||
gen_schema(bridges_v2) ->
|
gen_schema(bridges_v2) ->
|
||||||
bridge_v2_schema_json().
|
bridge_v2_schema_json();
|
||||||
|
gen_schema(connectors) ->
|
||||||
|
connectors_schema_json().
|
||||||
|
|
||||||
bridge_v2_schema_json() ->
|
bridge_v2_schema_json() ->
|
||||||
SchemaInfo = #{title => <<"EMQX Data Bridge V2 API Schema">>, version => <<"0.1.0">>},
|
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(emqx_bridge_v2_api, SchemaInfo).
|
||||||
|
|
||||||
|
connectors_schema_json() ->
|
||||||
|
SchemaInfo = #{title => <<"EMQX Connectors Schema">>, version => <<"0.1.0">>},
|
||||||
|
gen_api_schema_json_iodata(emqx_connector_api, SchemaInfo).
|
||||||
|
|
||||||
gen_api_schema_json_iodata(SchemaMod, SchemaInfo) ->
|
gen_api_schema_json_iodata(SchemaMod, SchemaInfo) ->
|
||||||
emqx_dashboard_swagger:gen_api_schema_json_iodata(
|
emqx_dashboard_swagger:gen_api_schema_json_iodata(
|
||||||
SchemaMod,
|
SchemaMod,
|
||||||
|
|
Loading…
Reference in New Issue