membphis commented on a change in pull request #2268:
URL: https://github.com/apache/apisix/pull/2268#discussion_r492435682



##########
File path: apisix/admin/init.lua
##########
@@ -108,6 +109,11 @@ local function run()
         seg_sub_path = core.table.concat(uri_segs, "/", 7)
     end
 
+    -- plugin metadata

Review comment:
       I do not like this process, I accept `plugin_metadata` as key.

##########
File path: apisix/admin/plugin_metadata.lua
##########
@@ -0,0 +1,118 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local pcall   = pcall
+local require = require
+local core    = require("apisix.core")
+
+local _M = {
+    version = 0.1,

Review comment:
       this version is useless, let us drop it

##########
File path: apisix/schema_def.lua
##########
@@ -602,6 +602,11 @@ _M.stream_route = {
     }
 }
 
+_M.plugin_metadata = {

Review comment:
       I think we can move this to `plugin`.
   
   Here is an example:
   
   ```
   local _M = {
       version = 0.1,
       priority = 100,
       name = plugin_name,
       schema = schema,
       schema_metadata = {
           -- ... ...
       }
   }
   ```

##########
File path: apisix/schema_def.lua
##########
@@ -602,6 +602,11 @@ _M.stream_route = {
     }
 }
 
+_M.plugin_metadata = {

Review comment:
       I think we can move this to `plugin`.
   
   Here is an example:
   
   ```lua
   local _M = {
       version = 0.1,
       priority = 100,
       name = plugin_name,
       schema = schema,
       schema_metadata = {
           -- ... ...
       }
   }
   ```

##########
File path: doc/admin-api.md
##########
@@ -660,4 +661,33 @@ Config Example:
 }
 ```
 
+## Plugin Metadata
+
+*API*:/apisix/admin/plugin_metadata/{plugin_name}
+
+*Description*: plugin metadata.
+
+> Request Methods:
+
+|Method      |Request URI|Request Body|Description        |
+|---------|-------------------------|--|------|
+|GET      |/apisix/admin/plugin_metadata/{plugin_name}|NULL|Fetch resource|
+|PUT      |/apisix/admin/plugin_metadata/{plugin_name}|{...}|Create resource 
by plugin name|
+|DELETE   |/apisix/admin/plugin_metadata/{plugin_name}|NULL|Remove resource|
+
+> Request Body Parameters:
+
+An object with at least one property and at most 10 properties.
+
+
+Config Example:
+
+```shell

Review comment:
       we need a real example, how about we use plugin `example-plugin`

##########
File path: apisix/schema_def.lua
##########
@@ -602,6 +602,11 @@ _M.stream_route = {
     }
 }
 
+_M.plugin_metadata = {

Review comment:
       do we need to delete those code? it should be wrong.

##########
File path: doc/admin-api.md
##########
@@ -660,4 +661,36 @@ Config Example:
 }
 ```
 
+## Plugin Metadata
+
+*API*:/apisix/admin/plugin_metadata/{plugin_name}
+
+*Description*: plugin metadata.
+
+> Request Methods:
+
+|Method      |Request URI|Request Body|Description        |
+|---------|-------------------------|--|------|
+|GET      |/apisix/admin/plugin_metadata/{plugin_name}|NULL|Fetch resource|
+|PUT      |/apisix/admin/plugin_metadata/{plugin_name}|{...}|Create resource 
by plugin name|
+|DELETE   |/apisix/admin/plugin_metadata/{plugin_name}|NULL|Remove resource|
+
+> Request Body Parameters:
+
+An object with at least one property and at most 10 properties.

Review comment:
       And we need to add some doc in `how to develop plugin`, the developer 
need it:
   
   
https://github.com/apache/apisix/blob/4f83f09eebbf10e5b33765c6b331e42fdc3862e3/doc/plugin-develop.md

##########
File path: doc/admin-api.md
##########
@@ -660,4 +661,36 @@ Config Example:
 }
 ```
 
+## Plugin Metadata
+
+*API*:/apisix/admin/plugin_metadata/{plugin_name}
+
+*Description*: plugin metadata.
+
+> Request Methods:
+
+|Method      |Request URI|Request Body|Description        |
+|---------|-------------------------|--|------|
+|GET      |/apisix/admin/plugin_metadata/{plugin_name}|NULL|Fetch resource|
+|PUT      |/apisix/admin/plugin_metadata/{plugin_name}|{...}|Create resource 
by plugin name|
+|DELETE   |/apisix/admin/plugin_metadata/{plugin_name}|NULL|Remove resource|
+
+> Request Body Parameters:
+
+An object with at least one property and at most 10 properties.

Review comment:
       wrong comments, please update it




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to