tzssangglass commented on issue #8111:
URL: https://github.com/apache/apisix/issues/8111#issuecomment-1294823080

   > I also tried to use the mirror of the latest version, and the empty array 
still returns an empty object
   
   I tested it, no problem.
   
   Modify the schema of example-plugin as follows:
   
   ```lua
   local schema = {
       type = "object",
       properties = {
           i = {type = "number", minimum = 0},
           s = {type = "string"},
           t = {type = "array", minItems = 0},
           ip = {type = "string"},
           port = {type = "integer"},
       },
       required = {"i"},
   }
   ```
   
   `t` is a array and can be empty array.
   
   test:
   
   ```shell
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "plugins": {
           "example-plugin": {
               "i": 11,
               "t": []
           }
       },
       "uri": "/server_port"
   }'
   
   ```
   
   I get response as:
   
   ```
   
{"key":"\/apisix\/routes\/1","value":{"status":1,"priority":0,"create_time":1666952451,"id":"1","update_time":1666952451,"uri":"\/server_port","plugins":{"example-plugin":{"t":[],"i":11}}}}
   ```
   
   you can see:`"t":[]`.


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to