Skip to content

Commit fcab335

Browse files
committed
revert(api): remove /plugins/schema/:name
Partially reverts #10846 Even though we have been emitting deprecation warnings when the endpoint was used, we didn't remove it in 3.0, and doing it now can be a surprise breaking change for someone. In fact, someone had to update a project which was relying on that path, that is linked in #10846 This reverts the removal and replaces the deprecation version with 4.0 instead of 3.0. This PR does not revert the changes in our tests to use the new endpoint instead of the deprecated one.
1 parent 91dcd61 commit fcab335

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

kong/api/routes/plugins.lua

+18
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local utils = require "kong.tools.utils"
33
local reports = require "kong.reports"
44
local endpoints = require "kong.api.endpoints"
55
local arguments = require "kong.api.arguments"
6+
local api_helpers = require "kong.api.api_helpers"
67

78

89
local ngx = ngx
@@ -119,6 +120,23 @@ return {
119120
PATCH = patch_plugin
120121
},
121122

123+
["/plugins/schema/:name"] = {
124+
GET = function(self, db)
125+
kong.log.deprecation("/plugins/schema/:name endpoint is deprecated, ",
126+
"please use /schemas/plugins/:name instead", {
127+
after = "1.2.0",
128+
removal = "4.0.0",
129+
})
130+
local subschema = db.plugins.schema.subschemas[self.params.name]
131+
if not subschema then
132+
return kong.response.exit(404, { message = "No plugin named '" .. self.params.name .. "'" })
133+
end
134+
135+
local copy = api_helpers.schema_to_jsonable(subschema.fields.config)
136+
return kong.response.exit(200, copy)
137+
end
138+
},
139+
122140
["/plugins/enabled"] = {
123141
GET = function()
124142
local enabled_plugins = setmetatable({}, cjson.array_mt)

0 commit comments

Comments
 (0)