Skip to content

Commit

Permalink
fix(plugins): add len_min=0 for string fields (#12421)
Browse files Browse the repository at this point in the history
Shorthand fields even though are transient still
use validation. For a string field if it's minimum
length is not defined then the default is 1 to
disallow empty strings.

However for some of the fields underneath shorthand fields
we wanted to allow empty strings therefore we need to add
this len_min=0 to those string fields that can be empty.

KAG-3388
  • Loading branch information
nowNick authored Jan 25, 2024
1 parent 60a9559 commit afae9d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kong/plugins/acme/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ local KONG_STORAGE_SCHEMA = {
local LEGACY_SCHEMA_TRANSLATIONS = {
{ auth = {
type = "string",
len_min = 0,
func = function(value)
deprecation("acme: config.storage_config.redis.auth is deprecated, please use config.storage_config.redis.password instead",
{ after = "4.0", })
Expand All @@ -57,6 +58,7 @@ local LEGACY_SCHEMA_TRANSLATIONS = {
}},
{ namespace = {
type = "string",
len_min = 0,
func = function(value)
deprecation("acme: config.storage_config.redis.namespace is deprecated, please use config.storage_config.redis.extra_options.namespace instead",
{ after = "4.0", })
Expand Down
1 change: 1 addition & 0 deletions kong/plugins/rate-limiting/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ return {
} },
{ redis_password = {
type = "string",
len_min = 0,
func = function(value)
deprecation("rate-limiting: config.redis_password is deprecated, please use config.redis.password instead",
{ after = "4.0", })
Expand Down
1 change: 1 addition & 0 deletions kong/plugins/response-ratelimiting/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ return {
} },
{ redis_password = {
type = "string",
len_min = 0,
func = function(value)
deprecation("response-ratelimiting: config.redis_password is deprecated, please use config.redis.password instead",
{ after = "4.0", })
Expand Down

0 comments on commit afae9d0

Please sign in to comment.