Merge pull request #9668 from thalesmg/fix-bridge-name-type-fields-v50

fix(mongodb): add `type` and `name` fields to the `get`/`post` API docs
This commit is contained in:
Thales Macedo Garitezi 2023-01-04 10:03:50 -03:00 committed by GitHub
commit c99ef2aedf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 6 deletions

View File

@ -64,4 +64,26 @@ emqx_ee_bridge_mongodb {
zh: "MongoDB独立配置" zh: "MongoDB独立配置"
} }
} }
desc_type {
desc {
en: """The Bridge Type."""
zh: """桥接类型。"""
}
label {
en: "Bridge Type"
zh: "桥接类型"
}
}
desc_name {
desc {
en: """Bridge name."""
zh: """桥接名称。"""
}
label {
en: "Bridge Name"
zh: "桥接名称"
}
}
} }

View File

@ -46,11 +46,11 @@ fields(mongodb_sharded) ->
fields(mongodb_single) -> fields(mongodb_single) ->
emqx_connector_mongo:fields(single) ++ fields("config"); emqx_connector_mongo:fields(single) ++ fields("config");
fields("post_rs") -> fields("post_rs") ->
fields(mongodb_rs); fields(mongodb_rs) ++ type_and_name_fields(mongodb_rs);
fields("post_sharded") -> fields("post_sharded") ->
fields(mongodb_sharded); fields(mongodb_sharded) ++ type_and_name_fields(mongodb_sharded);
fields("post_single") -> fields("post_single") ->
fields(mongodb_single); fields(mongodb_single) ++ type_and_name_fields(mongodb_single);
fields("put_rs") -> fields("put_rs") ->
fields(mongodb_rs); fields(mongodb_rs);
fields("put_sharded") -> fields("put_sharded") ->
@ -58,11 +58,17 @@ fields("put_sharded") ->
fields("put_single") -> fields("put_single") ->
fields(mongodb_single); fields(mongodb_single);
fields("get_rs") -> fields("get_rs") ->
emqx_bridge_schema:metrics_status_fields() ++ fields(mongodb_rs); emqx_bridge_schema:metrics_status_fields() ++
fields(mongodb_rs) ++
type_and_name_fields(mongodb_rs);
fields("get_sharded") -> fields("get_sharded") ->
emqx_bridge_schema:metrics_status_fields() ++ fields(mongodb_sharded); emqx_bridge_schema:metrics_status_fields() ++
fields(mongodb_sharded) ++
type_and_name_fields(mongodb_sharded);
fields("get_single") -> fields("get_single") ->
emqx_bridge_schema:metrics_status_fields() ++ fields(mongodb_single). emqx_bridge_schema:metrics_status_fields() ++
fields(mongodb_single) ++
type_and_name_fields(mongodb_single).
conn_bridge_examples(Method) -> conn_bridge_examples(Method) ->
[ [
@ -103,6 +109,12 @@ desc(_) ->
%% Internal fns %% Internal fns
%%================================================================================================= %%=================================================================================================
type_and_name_fields(MongoType) ->
[
{type, mk(MongoType, #{required => true, desc => ?DESC("desc_type")})},
{name, mk(binary(), #{required => true, desc => ?DESC("desc_name")})}
].
values(mongodb_rs = MongoType, Method) -> values(mongodb_rs = MongoType, Method) ->
TypeOpts = #{ TypeOpts = #{
servers => <<"localhost:27017, localhost:27018">>, servers => <<"localhost:27017, localhost:27018">>,