Skip to content

Commit

Permalink
feat: make A/B test APISIX easier by removing "additionalProperties =…
Browse files Browse the repository at this point in the history
… false" (#4797)

Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander authored Aug 12, 2021
1 parent cd34279 commit 22ee20c
Show file tree
Hide file tree
Showing 37 changed files with 155 additions and 611 deletions.
2 changes: 0 additions & 2 deletions apisix/plugins/authz-casbin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ local schema = {
{required = {"model_path", "policy_path", "username"}},
{required = {"model", "policy", "username"}}
},
additionalProperties = false
}

local metadata_schema = {
Expand All @@ -46,7 +45,6 @@ local metadata_schema = {
policy = {type = "string"},
},
required = {"model", "policy"},
additionalProperties = false
}

local _M = {
Expand Down
2 changes: 0 additions & 2 deletions apisix/plugins/basic-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ local schema = {
type = "object",
title = "work with route or service object",
properties = {},
additionalProperties = false,
}

local consumer_schema = {
Expand All @@ -42,7 +41,6 @@ local consumer_schema = {
password = { type = "string" },
},
required = {"username", "password"},
additionalProperties = false,
}

local plugin_name = "basic-auth"
Expand Down
3 changes: 0 additions & 3 deletions apisix/plugins/batch-requests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ local attr_schema = {
default = default_uri
}
},
additionalProperties = false,
}

local schema = {
type = "object",
additionalProperties = false,
}

local default_max_body_size = 1024 * 1024 -- 1MiB
Expand All @@ -56,7 +54,6 @@ local metadata_schema = {
default = default_max_body_size,
},
},
additionalProperties = false,
}

local method_schema = core.table.clone(core.schema.method_schema)
Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/echo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ local schema = {
{required = {"after_body"}}
},
minProperties = 1,
additionalProperties = false,
}

local plugin_name = "echo"
Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/example-plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ local metadata_schema = {
skey = {type = "string"},
},
required = {"ikey", "skey"},
additionalProperties = false,
}

local plugin_name = "example-plugin"
Expand Down
2 changes: 0 additions & 2 deletions apisix/plugins/hmac-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ local schema = {
type = "object",
title = "work with route or service object",
properties = {},
additionalProperties = false,
}

local consumer_schema = {
Expand Down Expand Up @@ -83,7 +82,6 @@ local consumer_schema = {
}
},
required = {"access_key", "secret_key"},
additionalProperties = false,
}

local _M = {
Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/http-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ local metadata_schema = {
properties = {
log_format = log_util.metadata_schema_log_format,
},
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/ip-restriction/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ local schema = {
{required = {"whitelist"}},
{required = {"blacklist"}},
},
additionalProperties = false,
}


Expand Down
2 changes: 0 additions & 2 deletions apisix/plugins/jwt-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ local lrucache = core.lrucache.new({

local schema = {
type = "object",
additionalProperties = false,
properties = {},
}

local consumer_schema = {
type = "object",
-- can't use additionalProperties with dependencies
-- additionalProperties = false,
properties = {
key = {type = "string"},
secret = {type = "string"},
Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/kafka-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ local metadata_schema = {
properties = {
log_format = log_util.metadata_schema_log_format,
},
additionalProperties = false,
}

local _M = {
Expand Down
2 changes: 0 additions & 2 deletions apisix/plugins/key-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ local lrucache = core.lrucache.new({

local schema = {
type = "object",
additionalProperties = false,
properties = {
header = {
type = "string",
Expand All @@ -41,7 +40,6 @@ local schema = {

local consumer_schema = {
type = "object",
additionalProperties = false,
properties = {
key = {type = "string"},
},
Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/log-rotate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ local MAX_KEPT = 24 * 7 -- max number of log files will be kept
local schema = {
type = "object",
properties = {},
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/node-status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ local ipairs = ipairs

local schema = {
type = "object",
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/prometheus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ local schema = {
default = false
}
},
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/proxy-rewrite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ local schema = {
},
},
minProperties = 1,
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/referer-restriction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ local schema = {
},
},
required = {"whitelist"},
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/response-rewrite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ local schema = {
},
},
minProperties = 1,
additionalProperties = false,
}


Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/server-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ local default_report_ttl = 7200

local schema = {
type = "object",
additionalProperties = false,
}
local attr_schema = {
type = "object",
Expand Down
2 changes: 0 additions & 2 deletions apisix/plugins/skywalking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ local attr_schema = {
type = "integer",
},
},
additionalProperties = false,
}

local schema = {
Expand All @@ -58,7 +57,6 @@ local schema = {
default = 1
}
},
additionalProperties = false,
}


Expand Down
2 changes: 0 additions & 2 deletions apisix/plugins/traffic-split.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ local schema = {
match = match_schema,
weighted_upstreams = upstreams_schema
},
additionalProperties = false
}
}
},
additionalProperties = false
}

local plugin_name = "traffic-split"
Expand Down
1 change: 0 additions & 1 deletion apisix/plugins/ua-restriction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ local schema = {
default = "Not allowed"
},
},
additionalProperties = false,
}

local plugin_name = "ua-restriction"
Expand Down
9 changes: 0 additions & 9 deletions apisix/schema_def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ local health_checker = {
}
}
},
additionalProperties = false,
anyOf = {
{required = {"active"}},
{required = {"active", "passive"}},
Expand Down Expand Up @@ -642,7 +641,6 @@ _M.route = {
{required = {"script", "plugin_config_id"}},
}
},
additionalProperties = false,
}


Expand All @@ -665,7 +663,6 @@ _M.service = {
},

},
additionalProperties = false,
}


Expand All @@ -683,7 +680,6 @@ _M.consumer = {
desc = desc_def,
},
required = {"username"},
additionalProperties = false,
}


Expand Down Expand Up @@ -748,7 +744,6 @@ _M.ssl = {
{required = {"sni", "key", "cert"}},
{required = {"snis", "key", "cert"}}
},
additionalProperties = false,
}


Expand All @@ -765,7 +760,6 @@ _M.proto = {
}
},
required = {"content"},
additionalProperties = false,
}


Expand All @@ -778,7 +772,6 @@ _M.global_rule = {
update_time = timestamp_def
},
required = {"plugins"},
additionalProperties = false,
}


Expand Down Expand Up @@ -823,7 +816,6 @@ _M.plugins = {
stream = {
type = "boolean"
},
additionalProperties = false,
},
required = {"name"}
}
Expand All @@ -841,7 +833,6 @@ _M.plugin_config = {
update_time = timestamp_def
},
required = {"id", "plugins"},
additionalProperties = false,
}


Expand Down
2 changes: 0 additions & 2 deletions docs/en/latest/plugin-develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ local metadata_schema = {
skey = {type = "string"},
},
required = {"ikey", "skey"},
additionalProperties = false,
}
local plugin_name = "example-plugin"
Expand Down Expand Up @@ -268,7 +267,6 @@ To validate the configuration, the plugin uses a schema like this:
```lua
local consumer_schema = {
type = "object",
additionalProperties = false,
properties = {
key = {type = "string"},
},
Expand Down
2 changes: 0 additions & 2 deletions docs/zh/latest/plugin-develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ local metadata_schema = {
skey = {type = "string"},
},
required = {"ikey", "skey"},
additionalProperties = false,
}

local plugin_name = "example-plugin"
Expand Down Expand Up @@ -214,7 +213,6 @@ local _M = {
```lua
local consumer_schema = {
type = "object",
additionalProperties = false,
properties = {
key = {type = "string"},
},
Expand Down
Loading

0 comments on commit 22ee20c

Please sign in to comment.