PGBI / kong-dashboard

Dashboard for managing Kong gateway
MIT License
2.18k stars 391 forks source link

Plugins with a config property with type 'array' is not correctly supported #108

Open Mario54 opened 7 years ago

Mario54 commented 7 years ago

GET apis/<api-id>/plugins/<plugin-id>

{
   "api_id":"600a0702-a4b8-4bb3-a309-379c5cd06835",
   "id":"cc4ed6d0-dd29-40b7-aa73-10cc35d919c6",
   "created_at":1496941053000,
   "enabled":true,
   "name":"<redacted>",
   "config":{
      "allowed_access_domains":[
         {
            "applicationId":"...",
            "environment":"..."
         }
      ],
      "exposure_domain":"...",
      "skip_domain_check":false,
      "authentication_url":"http://localhost:5000/v1"
   }
}

Notice the config allowed_access_domains which is an array. In Kong dashboard, it shows up as [object Object] in the field. More importantly, if I save the plugin, "[object Object]" is sent to the Kong API and saved as so.

image

GET apis/<api-id>/plugins/<plugin-id> (after saving)

{
   "api_id":"600a0702-a4b8-4bb3-a309-379c5cd06835",
   "id":"cc4ed6d0-dd29-40b7-aa73-10cc35d919c6",
   "created_at":1496941053000,
   "enabled":true,
   "name":"<redacted>",
   "config":{
      "allowed_access_domains": ["[object Object]"],
      "exposure_domain":"api",
      "skip_domain_check":false,
      "authentication_url":"http://localhost:5000/v1"
   }
}
PGBI commented 7 years ago

@Mario54 Is there any mashape-supported plugins with an array type property? I couldn't find any.

Mario54 commented 7 years ago

I don't think so. This is a custom plugin. But it is supported by Kong: https://getkong.org/docs/0.10.x/plugin-development/plugin-configuration/.

Given that plugins developed by Mashape don't use this, I understand that it wouldn't be a priority, but I thought it would worth reporting the bug.

PGBI commented 7 years ago

To be more precise, Kong-dashboard does support config properties of the "array" type. But only array of strings. Not array of objects.

I could take a look at how to work on supporting array of objects, but without a plugin with such a configuration type, it's hard to me to work on that and test it.

If you could provide a docker image of a Kong instance with your custom plugin installed, that would be great.