chore: hide `enable` fields from docgen

Fixes https://emqx.atlassian.net/browse/EMQX-12730
This commit is contained in:
Thales Macedo Garitezi 2024-07-19 17:34:17 -03:00
parent 65544f34ec
commit 69f5b6fa6c
33 changed files with 119 additions and 104 deletions

View File

@ -351,6 +351,7 @@ fields("authz_cache") ->
#{
default => true,
required => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(fields_cache_enable)
}
)},
@ -387,6 +388,7 @@ fields("flapping_detect") ->
boolean(),
#{
default => false,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(flapping_detect_enable)
}
)},
@ -423,6 +425,7 @@ fields("force_shutdown") ->
boolean(),
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(force_shutdown_enable)
}
)},
@ -452,6 +455,7 @@ fields("overload_protection") ->
boolean(),
#{
desc => ?DESC(overload_protection_enable),
importance => ?IMPORTANCE_NO_DOC,
default => false
}
)},
@ -512,7 +516,11 @@ fields("force_gc") ->
{"enable",
sc(
boolean(),
#{default => true, desc => ?DESC(force_gc_enable)}
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(force_gc_enable)
}
)},
{"count",
sc(
@ -1665,6 +1673,7 @@ fields("durable_sessions") ->
sc(
boolean(), #{
desc => ?DESC(durable_sessions_enable),
importance => ?IMPORTANCE_NO_DOC,
default => false
}
)},
@ -1888,6 +1897,7 @@ base_listener(Bind) ->
#{
default => true,
aliases => [enabled],
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(fields_listener_enabled)
}
)},
@ -2416,6 +2426,7 @@ client_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => false,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(client_ssl_opts_schema_enable)
}
)},

View File

@ -203,6 +203,7 @@ common_fields() ->
enable(type) -> boolean();
enable(default) -> true;
enable(importance) -> ?IMPORTANCE_NO_DOC;
enable(desc) -> ?DESC(?FUNCTION_NAME);
enable(_) -> undefined.

View File

@ -170,7 +170,12 @@ api_authz_refs() ->
authz_common_fields(Type) ->
[
{type, ?HOCON(Type, #{required => true, desc => ?DESC(type)})},
{enable, ?HOCON(boolean(), #{default => true, desc => ?DESC(enable)})}
{enable,
?HOCON(boolean(), #{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(enable)
})}
].
source_types() ->

View File

@ -123,6 +123,7 @@ common_bridge_fields() ->
boolean(),
#{
desc => ?DESC("desc_enable"),
importance => ?IMPORTANCE_NO_DOC,
default => true
}
)},

View File

@ -65,6 +65,7 @@
-export([
make_producer_action_schema/1, make_producer_action_schema/2,
make_consumer_action_schema/1, make_consumer_action_schema/2,
common_fields/0,
top_level_common_action_keys/0,
top_level_common_source_keys/0,
project_to_actions_resource_opts/1,
@ -507,16 +508,26 @@ make_consumer_action_schema(ParametersRef, Opts) ->
})}
].
common_schema(ParametersRef, _Opts) ->
common_fields() ->
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
{enable,
mk(boolean(), #{
desc => ?DESC("config_enable"),
importance => ?IMPORTANCE_NO_DOC,
default => true
})},
{connector,
mk(binary(), #{
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()},
{description, emqx_schema:description_schema()}
].
common_schema(ParametersRef, _Opts) ->
[
{parameters, ParametersRef}
| common_fields()
].
project_to_actions_resource_opts(OldResourceOpts) ->

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_azure_event_hub, [
{description, "EMQX Enterprise Azure Event Hub Bridge"},
{vsn, "0.1.7"},
{vsn, "0.1.8"},
{registered, []},
{applications, [
kernel,

View File

@ -129,16 +129,7 @@ fields(actions) ->
override(
emqx_bridge_kafka:producer_opts(action),
bridge_v2_overrides()
) ++
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
{connector,
mk(binary(), #{
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()}
],
) ++ emqx_bridge_v2_schema:common_fields(),
override_documentations(Fields);
fields(Method) ->
Fields = emqx_bridge_kafka:fields(Method),

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_confluent, [
{description, "EMQX Enterprise Confluent Connector and Action"},
{vsn, "0.1.2"},
{vsn, "0.1.3"},
{registered, []},
{applications, [
kernel,

View File

@ -116,16 +116,7 @@ fields(actions) ->
override(
emqx_bridge_kafka:producer_opts(action),
bridge_v2_overrides()
) ++
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
{connector,
mk(binary(), #{
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()}
],
) ++ emqx_bridge_v2_schema:common_fields(),
override_documentations(Fields);
fields(Method) ->
Fields = emqx_bridge_kafka:fields(Method),

View File

@ -72,14 +72,8 @@ fields(action) ->
}
)};
fields("http_action") ->
emqx_bridge_v2_schema:common_fields() ++
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable_bridge"), default => true})},
{connector,
mk(binary(), #{
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()},
%% Note: there's an implicit convention in `emqx_bridge' that,
%% for egress bridges with this config, the published messages
%% will be forwarded to such bridges.

View File

@ -297,15 +297,7 @@ fields("config_consumer") ->
fields(kafka_producer) ->
connector_config_fields() ++ producer_opts(v1);
fields(kafka_producer_action) ->
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
{connector,
mk(binary(), #{
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()}
] ++ producer_opts(action);
emqx_bridge_v2_schema:common_fields() ++ producer_opts(action);
fields(kafka_consumer) ->
connector_config_fields() ++ fields(consumer_opts);
fields(ssl_client_opts) ->

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_syskeeper, [
{description, "EMQX Enterprise Data bridge for Syskeeper"},
{vsn, "0.1.3"},
{vsn, "0.1.4"},
{registered, []},
{applications, [
kernel,

View File

@ -84,30 +84,16 @@ fields(action) ->
}
)};
fields(config) ->
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()},
{connector,
mk(binary(), #{
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
})},
{parameters,
emqx_bridge_v2_schema:make_producer_action_schema(
mk(
ref(?MODULE, "parameters"),
#{required => true, desc => ?DESC("parameters")}
)},
{local_topic, mk(binary(), #{required => false, desc => ?DESC(mqtt_topic)})},
{resource_opts,
mk(
ref(?MODULE, "creation_opts"),
#{
required => false,
default => #{},
desc => ?DESC(emqx_resource_schema, <<"resource_opts">>)
required => true,
desc => ?DESC("parameters")
}
)}
];
),
#{resource_opts_ref => ref(?MODULE, "creation_opts")}
);
fields("parameters") ->
[
{target_topic,

View File

@ -39,7 +39,12 @@ links_schema(Meta) ->
fields("link") ->
[
{enable, ?HOCON(boolean(), #{default => true, desc => ?DESC(enable)})},
{enable,
?HOCON(boolean(), #{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(enable)
})},
{name, ?HOCON(binary(), #{required => true, desc => ?DESC(link_name)})},
{server,
emqx_schema:servers_sc(#{required => true, desc => ?DESC(server)}, ?MQTT_HOST_OPTS)},

View File

@ -997,6 +997,7 @@ fields("log_overload_kill") ->
boolean(),
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC("log_overload_kill_enable")
}
)},
@ -1032,6 +1033,7 @@ fields("log_burst_limit") ->
boolean(),
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC("log_burst_limit_enable")
}
)},
@ -1285,7 +1287,7 @@ log_handler_common_confs(Handler, Default) ->
#{
default => Enable,
desc => ?DESC("common_handler_enable"),
importance => ?IMPORTANCE_MEDIUM
importance => ?IMPORTANCE_NO_DOC
}
)},
{"formatter",

View File

@ -489,7 +489,12 @@ api_fields("put_connector", _Type, Fields) ->
common_fields() ->
[
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
{enable,
mk(boolean(), #{
desc => ?DESC("config_enable"),
importance => ?IMPORTANCE_NO_DOC,
default => true
})},
{tags, emqx_schema:tags_schema()},
{description, emqx_schema:description_schema()}
].

View File

@ -1008,7 +1008,7 @@ parse_object_loop([{Name, Hocon} | Rest], Module, Options, Props, Required, Refs
%% return true if the field has 'importance' set to 'hidden'
is_hidden(Hocon) ->
hocon_schema:is_hidden(Hocon, #{include_importance_up_from => ?IMPORTANCE_LOW}).
hocon_schema:is_hidden(Hocon, #{include_importance_up_from => ?IMPORTANCE_NO_DOC}).
is_required(Hocon) ->
hocon_schema:field_schema(Hocon, required) =:= true.

View File

@ -47,6 +47,7 @@ common_backend_schema(Backend) ->
mk(
boolean(), #{
desc => ?DESC(backend_enable),
importance => ?IMPORTANCE_NO_DOC,
required => false,
default => false
}

View File

@ -53,7 +53,6 @@ fields("log_audit_handler") ->
importance => ?IMPORTANCE_HIDDEN
}
)},
{"path",
hoconsc:mk(
string(),

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*-
{application, emqx_exhook, [
{description, "EMQX Extension for Hook"},
{vsn, "5.0.17"},
{vsn, "5.0.18"},
{modules, []},
{registered, []},
{mod, {emqx_exhook_app, []}},

View File

@ -54,6 +54,7 @@ fields(server) ->
{enable,
?HOCON(boolean(), #{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(enable)
})},
{url,

View File

@ -66,6 +66,7 @@ fields(file_transfer) ->
boolean(),
#{
desc => ?DESC("enable"),
importance => ?IMPORTANCE_NO_DOC,
required => false,
default => false
}
@ -242,6 +243,7 @@ common_backend_fields() ->
mk(
boolean(), #{
desc => ?DESC("backend_enable"),
importance => ?IMPORTANCE_NO_DOC,
required => false,
default => true
}

View File

@ -240,6 +240,7 @@ gateway_common_options() ->
boolean(),
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(gateway_common_enable)
}
)},
@ -413,6 +414,7 @@ common_listener_opts() ->
boolean(),
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(gateway_common_listener_enable)
}
)},

View File

@ -79,7 +79,12 @@ rewrite_validator(Rules) ->
fields("delayed") ->
[
{enable, ?HOCON(boolean(), #{default => true, desc => ?DESC(enable)})},
{enable,
?HOCON(boolean(), #{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(enable)
})},
{max_delayed_messages,
?HOCON(integer(), #{desc => ?DESC(max_delayed_messages), default => 0})}
];

View File

@ -1,6 +1,6 @@
{application, emqx_opentelemetry, [
{description, "OpenTelemetry for EMQX Broker"},
{vsn, "0.2.6"},
{vsn, "0.2.7"},
{registered, []},
{mod, {emqx_otel_app, []}},
{applications, [

View File

@ -72,6 +72,7 @@ fields("otel_metrics") ->
boolean(),
#{
default => false,
importance => ?IMPORTANCE_NO_DOC,
required => true,
desc => ?DESC(enable)
}
@ -104,7 +105,7 @@ fields("otel_logs") ->
#{
default => false,
desc => ?DESC(enable),
importance => ?IMPORTANCE_HIGH
importance => ?IMPORTANCE_NO_DOC
}
)},
{max_queue_size,
@ -143,7 +144,7 @@ fields("otel_traces") ->
#{
default => false,
desc => ?DESC(enable),
importance => ?IMPORTANCE_HIGH
importance => ?IMPORTANCE_NO_DOC
}
)},
{max_queue_size,

View File

@ -56,6 +56,8 @@ state_fields() ->
?HOCON(
boolean(),
#{
default => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(enable),
required => true
}

View File

@ -78,6 +78,7 @@ fields(push_gateway) ->
#{
default => false,
required => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(push_gateway_enable)
}
)},
@ -229,6 +230,7 @@ fields(legacy_deprecated_setting) ->
#{
default => false,
required => true,
importance => ?IMPORTANCE_NO_DOC,
desc => ?DESC(legacy_enable)
}
)},

View File

@ -2,7 +2,7 @@
{application, emqx_psk, [
{description, "EMQX PSK"},
% strict semver, bump manually!
{vsn, "5.0.6"},
{vsn, "5.0.7"},
{modules, []},
{registered, [emqx_psk_sup]},
{applications, [kernel, stdlib]},

View File

@ -42,6 +42,7 @@ fields() ->
[
{enable,
?HOCON(boolean(), #{
importance => ?IMPORTANCE_NO_DOC,
default => false,
require => true,
desc => ?DESC(enable)

View File

@ -43,7 +43,7 @@ roots() ->
fields("retainer") ->
[
{enable, sc(boolean(), enable, true)},
{enable, sc(boolean(), enable, true, ?IMPORTANCE_NO_DOC)},
{msg_expiry_interval,
sc(
%% not used in a `receive ... after' block, just timestamp comparison
@ -126,6 +126,7 @@ fields(mnesia_config) ->
{enable,
?HOCON(boolean(), #{
desc => ?DESC(mnesia_enable),
importance => ?IMPORTANCE_NO_DOC,
required => false,
default => true
})}

View File

@ -1,7 +1,7 @@
{application, emqx_slow_subs, [
{description, "EMQX Slow Subscribers Statistics"},
% strict semver, bump manually!
{vsn, "1.0.7"},
{vsn, "1.0.8"},
{modules, []},
{registered, [emqx_slow_subs_sup]},
{applications, [kernel, stdlib, emqx]},

View File

@ -27,7 +27,7 @@ roots() ->
fields("slow_subs") ->
[
{enable, sc(boolean(), false, enable)},
{enable, sc(boolean(), false, enable, ?IMPORTANCE_NO_DOC)},
{threshold,
sc(
%% not used in a `receive ... after' block, just timestamp comparison
@ -66,3 +66,6 @@ desc(_) ->
%%--------------------------------------------------------------------
sc(Type, Default, Desc) ->
?HOCON(Type, #{default => Default, desc => ?DESC(Desc)}).
sc(Type, Default, Desc, Importance) ->
?HOCON(Type, #{default => Default, desc => ?DESC(Desc), importance => Importance}).