feat(docs): add tags to schemas

This'll allow us to split the generated `schema.json` file into
subsections for better documentation navigation.
This commit is contained in:
Thales Macedo Garitezi 2022-12-06 16:47:55 -03:00
parent fde8752452
commit 48e1ba4832
16 changed files with 63 additions and 5 deletions

View File

@ -2342,7 +2342,7 @@ authentication(Which) ->
undefined -> hoconsc:array(typerefl:map());
Module -> Module:root_type()
end,
%% It is a lazy type because when handing runtime update requests
%% It is a lazy type because when handling runtime update requests
%% the config is not checked by emqx_schema, but by the injected schema
Type = hoconsc:lazy(Type0),
#{

View File

@ -22,6 +22,7 @@
-export([
common_fields/0,
roots/0,
tags/0,
fields/1,
authenticator_type/0,
authenticator_type_without_scram/0,
@ -32,6 +33,9 @@
roots() -> [].
tags() ->
[<<"Authentication">>].
common_fields() ->
[{enable, fun enable/1}].

View File

@ -25,6 +25,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -105,6 +106,9 @@ mnesia(boot) ->
namespace() -> "authn-scram-builtin_db".
tags() ->
[<<"Authentication">>].
roots() -> [?CONF_NS].
fields(?CONF_NS) ->

View File

@ -26,6 +26,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1,
@ -51,6 +52,9 @@
namespace() -> "authn-http".
tags() ->
[<<"Authentication">>].
roots() ->
[
{?CONF_NS,

View File

@ -25,6 +25,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -44,6 +45,9 @@
namespace() -> "authn-jwt".
tags() ->
[<<"Authentication">>].
roots() ->
[
{?CONF_NS,

View File

@ -26,6 +26,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -107,6 +108,9 @@ mnesia(boot) ->
namespace() -> "authn-builtin_db".
tags() ->
[<<"Authentication">>].
roots() -> [?CONF_NS].
fields(?CONF_NS) ->

View File

@ -25,6 +25,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -44,6 +45,9 @@
namespace() -> "authn-mongodb".
tags() ->
[<<"Authentication">>].
roots() ->
[
{?CONF_NS,

View File

@ -27,6 +27,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -46,6 +47,9 @@
namespace() -> "authn-mysql".
tags() ->
[<<"Authentication">>].
roots() -> [?CONF_NS].
fields(?CONF_NS) ->

View File

@ -26,6 +26,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -50,6 +51,9 @@
namespace() -> "authn-postgresql".
tags() ->
[<<"Authentication">>].
roots() -> [?CONF_NS].
fields(?CONF_NS) ->

View File

@ -25,6 +25,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1
@ -44,6 +45,9 @@
namespace() -> "authn-redis".
tags() ->
[<<"Authentication">>].
roots() ->
[
{?CONF_NS,

View File

@ -33,6 +33,7 @@
-export([
namespace/0,
roots/0,
tags/0,
fields/1,
validations/0,
desc/1
@ -65,6 +66,9 @@ type_names() ->
namespace() -> authz.
tags() ->
[<<"Authorization">>].
%% @doc authorization schema is not exported
%% but directly used by emqx_schema
roots() -> [].

View File

@ -20,7 +20,7 @@
-import(hoconsc, [mk/2, ref/2]).
-export([roots/0, fields/1, desc/1, namespace/0]).
-export([roots/0, fields/1, desc/1, namespace/0, tags/0]).
-export([
get_response/0,
@ -104,6 +104,9 @@ metrics_status_fields() ->
namespace() -> "bridge".
tags() ->
[<<"Bridge">>].
roots() -> [bridges].
fields(bridges) ->

View File

@ -38,7 +38,9 @@
cipher/0
]).
-export([namespace/0, roots/0, fields/1, translations/0, translation/1, validations/0, desc/1]).
-export([
namespace/0, roots/0, fields/1, translations/0, translation/1, validations/0, desc/1, tags/0
]).
-export([conf_get/2, conf_get/3, keys/2, filter/1]).
%% Static apps which merge their configs into the merged emqx.conf
@ -67,6 +69,9 @@
%% root config should not have a namespace
namespace() -> undefined.
tags() ->
[<<"EMQX">>].
roots() ->
PtKey = ?EMQX_AUTHENTICATION_SCHEMA_MODULE_PT_KEY,
case persistent_term:get(PtKey, undefined) of

View File

@ -49,12 +49,15 @@
]).
-elvis([{elvis_style, dont_repeat_yourself, disable}]).
-export([namespace/0, roots/0, fields/1, desc/1]).
-export([namespace/0, roots/0, fields/1, desc/1, tags/0]).
-export([proxy_protocol_opts/0]).
namespace() -> gateway.
tags() ->
[<<"Gateway">>].
roots() -> [gateway].
fields(gateway) ->

View File

@ -23,6 +23,7 @@
-export([
namespace/0,
tags/0,
roots/0,
fields/1,
desc/1,
@ -33,6 +34,9 @@
namespace() -> rule_engine.
tags() ->
[<<"Rule Engine">>].
roots() -> ["rule_engine"].
fields("rule_engine") ->

View File

@ -13,7 +13,7 @@
-behaviour(hocon_schema).
-export([roots/0, fields/1, validations/0, desc/1]).
-export([roots/0, fields/1, validations/0, desc/1, tags/0]).
-export([
default_license/0,
@ -31,6 +31,9 @@ roots() ->
)}
].
tags() ->
[<<"License">>].
fields(key_license) ->
[
{key, #{