You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/08/20 06:12:20 UTC

[GitHub] [apisix] membphis opened a new pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

membphis opened a new pull request #2091:
URL: https://github.com/apache/apisix/pull/2091


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   fix #2085
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] juzhiyuan commented on a change in pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #2091:
URL: https://github.com/apache/apisix/pull/2091#discussion_r473761750



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,21 +27,31 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    properties = {
-        whitelist = {
-            type = "array",
-            items = {type = "string", anyOf = core.schema.ip_def},
-            minItems = 1
+    oneOf = {
+        {
+            title = "whitelist",
+            properties = {
+                whitelist = {
+                    type = "array",
+                    items = {type = "string", anyOf = core.schema.ip_def},

Review comment:
       [Playground](https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJ3aGl0ZWxpc3QiOlsiMjIyIl0sImJsYWNrbGlzdCI6W251bGxdLCJmaXJzdE5hbWUiOiJDaHVjayIsImxhc3ROYW1lIjoiTm9ycmlzIiwiYWdlIjo3NSwiYmlvIjoiUm91bmRob3VzZSBraWNraW5nIGFzc2VzIHNpbmNlIDE5NDAiLCJwYXNzd29yZCI6Im5vbmVlZCJ9LCJzY2hlbWE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ZmFsc2V9fQ==)




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] juzhiyuan commented on a change in pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #2091:
URL: https://github.com/apache/apisix/pull/2091#discussion_r473760227



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,21 +27,31 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    properties = {
-        whitelist = {
-            type = "array",
-            items = {type = "string", anyOf = core.schema.ip_def},
-            minItems = 1
+    oneOf = {
+        {
+            title = "whitelist",
+            properties = {
+                whitelist = {
+                    type = "array",
+                    items = {type = "string", anyOf = core.schema.ip_def},

Review comment:
       ```json
   {
     "type": "object",
     "oneOf": [
       {
         "title": "whitelist",
         "properties": {
           "whitelist": {
             "title": "",
             "type": "array",
             "items": {
               "anyOf": [
                 {
                   "title": "Pattern 1",
                   "type": "string",
                   "pattern": "This is Pattern"
                 }
               ]
             },
             "minItems": 1
           }
         },
         "required": ["whitelist"],
         "additionalProperties": false
       }
     ]
   }
   ```
   
   This schema is ok for me.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] moonming merged pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

Posted by GitBox <gi...@apache.org>.
moonming merged pull request #2091:
URL: https://github.com/apache/apisix/pull/2091


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] membphis commented on a change in pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #2091:
URL: https://github.com/apache/apisix/pull/2091#discussion_r475094944



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,21 +27,31 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    properties = {
-        whitelist = {
-            type = "array",
-            items = {type = "string", anyOf = core.schema.ip_def},
-            minItems = 1
+    oneOf = {
+        {
+            title = "whitelist",
+            properties = {
+                whitelist = {
+                    type = "array",
+                    items = {type = "string", anyOf = core.schema.ip_def},

Review comment:
       fixed already




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] juzhiyuan commented on a change in pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #2091:
URL: https://github.com/apache/apisix/pull/2091#discussion_r473760683



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,21 +27,31 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    properties = {
-        whitelist = {
-            type = "array",
-            items = {type = "string", anyOf = core.schema.ip_def},
-            minItems = 1
+    oneOf = {
+        {
+            title = "whitelist",
+            properties = {
+                whitelist = {
+                    type = "array",
+                    items = {type = "string", anyOf = core.schema.ip_def},

Review comment:
       1. We should add type for every item in anyOf;
   2. remove string type from items.




----------------------------------------------------------------
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:
users@infra.apache.org