You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/06/21 11:38:31 UTC

[apisix] branch master updated: chore: explain why new injected fields should be under `_meta` (#7290)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 69bb8b394 chore: explain why new injected fields should be under `_meta` (#7290)
69bb8b394 is described below

commit 69bb8b394b8480dd14b518bba5c38970fe7bf24e
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Tue Jun 21 19:38:22 2022 +0800

    chore: explain why new injected fields should be under `_meta` (#7290)
    
    Signed-off-by: spacewander <sp...@gmail.com>
---
 apisix/plugin.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apisix/plugin.lua b/apisix/plugin.lua
index 5aad12e89..2276a5c33 100644
--- a/apisix/plugin.lua
+++ b/apisix/plugin.lua
@@ -151,6 +151,9 @@ local function load_plugin(name, plugins_list, plugin_type)
 
         properties._meta = plugin_injected_schema._meta
         -- new injected fields should be added under `_meta`
+        -- 1. so we won't break user's code when adding any new injected fields
+        -- 2. the semantics is clear, especially in the doc and in the caller side
+        -- TODO: move the `disable` to `_meta` too
 
         plugin.schema['$comment'] = plugin_injected_schema['$comment']
     end