diff --git a/kong/api/routes/plugins.lua b/kong/api/routes/plugins.lua index 9a522bec984..0336e85eac4 100644 --- a/kong/api/routes/plugins.lua +++ b/kong/api/routes/plugins.lua @@ -3,6 +3,7 @@ local utils = require "kong.tools.utils" local reports = require "kong.reports" local endpoints = require "kong.api.endpoints" local arguments = require "kong.api.arguments" +local api_helpers = require "kong.api.api_helpers" local ngx = ngx @@ -119,6 +120,23 @@ return { PATCH = patch_plugin }, + ["/plugins/schema/:name"] = { + GET = function(self, db) + kong.log.deprecation("/plugins/schema/:name endpoint is deprecated, ", + "please use /schemas/plugins/:name instead", { + after = "1.2.0", + removal = "4.0.0", + }) + local subschema = db.plugins.schema.subschemas[self.params.name] + if not subschema then + return kong.response.exit(404, { message = "No plugin named '" .. self.params.name .. "'" }) + end + + local copy = api_helpers.schema_to_jsonable(subschema.fields.config) + return kong.response.exit(200, copy) + end + }, + ["/plugins/enabled"] = { GET = function() local enabled_plugins = setmetatable({}, cjson.array_mt)