فهرست منبع

fix(emqx_authz_api_sources): make schema fit to what we send

Stefan Strigler 3 سال پیش
والد
کامیت
ba1e19f068
1فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 6 5
      apps/emqx_authz/src/emqx_authz_api_sources.erl

+ 6 - 5
apps/emqx_authz/src/emqx_authz_api_sources.erl

@@ -40,7 +40,8 @@
 -export([
 -export([
     api_spec/0,
     api_spec/0,
     paths/0,
     paths/0,
-    schema/1
+    schema/1,
+    fields/1
 ]).
 ]).
 
 
 -export([
 -export([
@@ -63,6 +64,9 @@ paths() ->
         "/authorization/sources/:type/move"
         "/authorization/sources/:type/move"
     ].
     ].
 
 
+fields(sources) ->
+    [{sources, mk(array(hoconsc:union(authz_sources_type_refs())), #{desc => ?DESC(sources)})}].
+
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
 %% Schema for each URI
 %% Schema for each URI
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
@@ -75,10 +79,7 @@ schema("/authorization/sources") ->
                 tags => ?TAGS,
                 tags => ?TAGS,
                 responses =>
                 responses =>
                     #{
                     #{
-                        200 => mk(
-                            array(hoconsc:union(authz_sources_type_refs())),
-                            #{desc => ?DESC(sources)}
-                        )
+                        200 => ref(?MODULE, sources)
                     }
                     }
             },
             },
         post =>
         post =>