From d38c9f5c3b81bed2b23e5d3c34db0f594acdbcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Garc=C3=ADa=20Cota?= Date: Thu, 4 Oct 2018 13:29:50 +0200 Subject: [PATCH] wip - add nullable = false to all plugin schema records --- kong/plugins/acl/schema.lua | 1 + kong/plugins/aws-lambda/schema.lua | 1 + kong/plugins/basic-auth/schema.lua | 1 + kong/plugins/bot-detection/schema.lua | 1 + kong/plugins/correlation-id/schema.lua | 1 + kong/plugins/cors/schema.lua | 1 + kong/plugins/datadog/schema.lua | 2 ++ kong/plugins/file-log/schema.lua | 1 + kong/plugins/galileo/schema.lua | 1 + kong/plugins/hmac-auth/schema.lua | 1 + kong/plugins/http-log/schema.lua | 1 + kong/plugins/ip-restriction/schema.lua | 1 + kong/plugins/jwt/schema.lua | 1 + kong/plugins/key-auth/schema.lua | 1 + kong/plugins/ldap-auth/schema.lua | 1 + kong/plugins/loggly/schema.lua | 1 + kong/plugins/oauth2/schema.lua | 1 + kong/plugins/rate-limiting/schema.lua | 1 + kong/plugins/request-size-limiting/schema.lua | 1 + kong/plugins/request-termination/schema.lua | 1 + kong/plugins/request-transformer/schema.lua | 3 +++ kong/plugins/response-ratelimiting/schema.lua | 1 + kong/plugins/response-transformer/schema.lua | 3 +++ kong/plugins/statsd/schema.lua | 2 ++ kong/plugins/syslog/schema.lua | 1 + kong/plugins/tcp-log/schema.lua | 1 + kong/plugins/udp-log/schema.lua | 1 + 27 files changed, 33 insertions(+) diff --git a/kong/plugins/acl/schema.lua b/kong/plugins/acl/schema.lua index dc689a8f057..0d7fd47febc 100644 --- a/kong/plugins/acl/schema.lua +++ b/kong/plugins/acl/schema.lua @@ -7,6 +7,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { whitelist = { type = "array", elements = { type = "string" }, }, }, { blacklist = { type = "array", elements = { type = "string" }, }, }, diff --git a/kong/plugins/aws-lambda/schema.lua b/kong/plugins/aws-lambda/schema.lua index 5b5c026b58e..1a698e976c5 100644 --- a/kong/plugins/aws-lambda/schema.lua +++ b/kong/plugins/aws-lambda/schema.lua @@ -19,6 +19,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { timeout = { type = "number", required = true, default = 60000 }, }, { keepalive = { type = "number", required = true, default = 60000 }, }, diff --git a/kong/plugins/basic-auth/schema.lua b/kong/plugins/basic-auth/schema.lua index c685231565b..6e37a471300 100644 --- a/kong/plugins/basic-auth/schema.lua +++ b/kong/plugins/basic-auth/schema.lua @@ -6,6 +6,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { anonymous = { type = "string", uuid = true, legacy = true }, }, { hide_credentials = { type = "boolean", default = false }, }, diff --git a/kong/plugins/bot-detection/schema.lua b/kong/plugins/bot-detection/schema.lua index dc420cd708d..8adce091863 100644 --- a/kong/plugins/bot-detection/schema.lua +++ b/kong/plugins/bot-detection/schema.lua @@ -6,6 +6,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { whitelist = { type = "array", diff --git a/kong/plugins/correlation-id/schema.lua b/kong/plugins/correlation-id/schema.lua index 7c9af87d470..685e528d075 100644 --- a/kong/plugins/correlation-id/schema.lua +++ b/kong/plugins/correlation-id/schema.lua @@ -3,6 +3,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { header_name = { type = "string", default = "Kong-Request-ID" }, }, { generator = { type = "string", default = "uuid#counter", diff --git a/kong/plugins/cors/schema.lua b/kong/plugins/cors/schema.lua index d7f0eedcbf1..c1308f99b6b 100644 --- a/kong/plugins/cors/schema.lua +++ b/kong/plugins/cors/schema.lua @@ -16,6 +16,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { origins = { type = "array", diff --git a/kong/plugins/datadog/schema.lua b/kong/plugins/datadog/schema.lua index eb57d574161..074b788dede 100644 --- a/kong/plugins/datadog/schema.lua +++ b/kong/plugins/datadog/schema.lua @@ -94,6 +94,7 @@ return { fields = { { config = { type = "record", + nullable = false, default = { metrics = DEFAULT_METRICS }, fields = { { host = typedefs.host({ required = true, default = "localhost" }), }, @@ -105,6 +106,7 @@ return { default = DEFAULT_METRICS, elements = { type = "record", + nullable = false, fields = { { name = { type = "string", required = true, one_of = STAT_NAMES }, }, { stat_type = { type = "string", required = true, one_of = STAT_TYPES }, }, diff --git a/kong/plugins/file-log/schema.lua b/kong/plugins/file-log/schema.lua index 95b82430f1e..093605ead76 100644 --- a/kong/plugins/file-log/schema.lua +++ b/kong/plugins/file-log/schema.lua @@ -18,6 +18,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { path = { type = "string", required = true, diff --git a/kong/plugins/galileo/schema.lua b/kong/plugins/galileo/schema.lua index 152970036be..cb9b81a44f7 100644 --- a/kong/plugins/galileo/schema.lua +++ b/kong/plugins/galileo/schema.lua @@ -5,6 +5,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { environment = { type = "string" }, }, { retry_count = { type = "integer", default = 10 }, }, diff --git a/kong/plugins/hmac-auth/schema.lua b/kong/plugins/hmac-auth/schema.lua index 1ce99bec42f..87140f11575 100644 --- a/kong/plugins/hmac-auth/schema.lua +++ b/kong/plugins/hmac-auth/schema.lua @@ -15,6 +15,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { hide_credentials = { type = "boolean", default = false }, }, { clock_skew = { type = "number", default = 300, gt = 0 }, }, diff --git a/kong/plugins/http-log/schema.lua b/kong/plugins/http-log/schema.lua index 41fd46ae1d1..aeb3a14754d 100644 --- a/kong/plugins/http-log/schema.lua +++ b/kong/plugins/http-log/schema.lua @@ -5,6 +5,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { http_endpoint = typedefs.url({ required = true }) }, { method = { type = "string", default = "POST", one_of = { "POST", "PUT", "PATCH" }, }, }, diff --git a/kong/plugins/ip-restriction/schema.lua b/kong/plugins/ip-restriction/schema.lua index ea4cba9ba43..ef7d5054c2b 100644 --- a/kong/plugins/ip-restriction/schema.lua +++ b/kong/plugins/ip-restriction/schema.lua @@ -19,6 +19,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { whitelist = { type = "array", elements = ip, }, }, { blacklist = { type = "array", elements = ip, }, }, diff --git a/kong/plugins/jwt/schema.lua b/kong/plugins/jwt/schema.lua index d3521b606d4..e6877c3f051 100644 --- a/kong/plugins/jwt/schema.lua +++ b/kong/plugins/jwt/schema.lua @@ -3,6 +3,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { uri_param_names = { type = "set", diff --git a/kong/plugins/key-auth/schema.lua b/kong/plugins/key-auth/schema.lua index 0d5d23cfe5c..16c3dbadb2f 100644 --- a/kong/plugins/key-auth/schema.lua +++ b/kong/plugins/key-auth/schema.lua @@ -7,6 +7,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { key_names = { type = "array", diff --git a/kong/plugins/ldap-auth/schema.lua b/kong/plugins/ldap-auth/schema.lua index f0a82bb83c2..e41731c3082 100644 --- a/kong/plugins/ldap-auth/schema.lua +++ b/kong/plugins/ldap-auth/schema.lua @@ -9,6 +9,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { ldap_host = typedefs.host({ required = true }), }, { ldap_port = typedefs.port({ required = true }), }, diff --git a/kong/plugins/loggly/schema.lua b/kong/plugins/loggly/schema.lua index 620951ba012..97beed60aac 100644 --- a/kong/plugins/loggly/schema.lua +++ b/kong/plugins/loggly/schema.lua @@ -10,6 +10,7 @@ return { name = "loggly", fields = { { config = { + nullable = false, type = "record", fields = { { host = typedefs.host({ default = "logs-01.loggly.com" }), }, diff --git a/kong/plugins/oauth2/schema.lua b/kong/plugins/oauth2/schema.lua index d0057b9288f..be48ca7ef44 100644 --- a/kong/plugins/oauth2/schema.lua +++ b/kong/plugins/oauth2/schema.lua @@ -18,6 +18,7 @@ return { { consumer = typedefs.no_consumer }, { config = { type = "record", + nullable = false, fields = { { scopes = { type = "array", elements = { type = "string" }, }, }, { mandatory_scope = { type = "boolean", default = false, required = true }, }, diff --git a/kong/plugins/rate-limiting/schema.lua b/kong/plugins/rate-limiting/schema.lua index 91d69dcf424..61473eafcbb 100644 --- a/kong/plugins/rate-limiting/schema.lua +++ b/kong/plugins/rate-limiting/schema.lua @@ -28,6 +28,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { second = { type = "number", gt = 0 }, }, { minute = { type = "number", gt = 0 }, }, diff --git a/kong/plugins/request-size-limiting/schema.lua b/kong/plugins/request-size-limiting/schema.lua index 77de19fde1b..259e802c9a6 100644 --- a/kong/plugins/request-size-limiting/schema.lua +++ b/kong/plugins/request-size-limiting/schema.lua @@ -3,6 +3,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { allowed_payload_size = { type = "integer", default = 128 }, }, }, diff --git a/kong/plugins/request-termination/schema.lua b/kong/plugins/request-termination/schema.lua index ae2042da3a2..854787581b6 100644 --- a/kong/plugins/request-termination/schema.lua +++ b/kong/plugins/request-termination/schema.lua @@ -8,6 +8,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { status_code = { type = "integer", diff --git a/kong/plugins/request-transformer/schema.lua b/kong/plugins/request-transformer/schema.lua index 7f8e2ac5be5..2067701b88b 100644 --- a/kong/plugins/request-transformer/schema.lua +++ b/kong/plugins/request-transformer/schema.lua @@ -10,6 +10,7 @@ local strings_array = { local strings_array_record = { type = "record", + nullable = false, fields = { { body = strings_array }, { headers = strings_array }, @@ -27,6 +28,7 @@ local colon_strings_array = { local colon_strings_array_record = { type = "record", + nullable = false, fields = { { body = colon_strings_array }, { headers = colon_strings_array }, @@ -40,6 +42,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { http_method = typedefs.http_method }, { remove = strings_array_record }, diff --git a/kong/plugins/response-ratelimiting/schema.lua b/kong/plugins/response-ratelimiting/schema.lua index 689cb0d1609..090f8e74d65 100644 --- a/kong/plugins/response-ratelimiting/schema.lua +++ b/kong/plugins/response-ratelimiting/schema.lua @@ -28,6 +28,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { header_name = { type = "string", default = "x-kong-limit" }, }, { limit_by = { type = "string", diff --git a/kong/plugins/response-transformer/schema.lua b/kong/plugins/response-transformer/schema.lua index 30929d11a02..65cc2d2105e 100644 --- a/kong/plugins/response-transformer/schema.lua +++ b/kong/plugins/response-transformer/schema.lua @@ -15,6 +15,7 @@ local colon_string_array = { local string_record = { type = "record", + nullable = false, fields = { { json = string_array }, { headers = string_array }, @@ -24,6 +25,7 @@ local string_record = { local colon_string_record = { type = "record", + nullable = false, fields = { { json = colon_string_array }, { headers = colon_string_array }, @@ -36,6 +38,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { remove = string_record }, { replace = colon_string_record }, diff --git a/kong/plugins/statsd/schema.lua b/kong/plugins/statsd/schema.lua index 63447409559..0cf738242c2 100644 --- a/kong/plugins/statsd/schema.lua +++ b/kong/plugins/statsd/schema.lua @@ -74,6 +74,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { host = typedefs.host({ default = "localhost" }), }, { port = typedefs.port({ default = 8125 }), }, @@ -83,6 +84,7 @@ return { default = DEFAULT_METRICS, elements = { type = "record", + nullable = false, fields = { { name = { type = "string", required = true, one_of = METRIC_NAMES }, }, { stat_type = { type = "string", required = true, one_of = STAT_TYPES }, }, diff --git a/kong/plugins/syslog/schema.lua b/kong/plugins/syslog/schema.lua index 10b35ffc190..4221ba4a481 100644 --- a/kong/plugins/syslog/schema.lua +++ b/kong/plugins/syslog/schema.lua @@ -9,6 +9,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { log_level = severity }, { successful_severity = severity }, diff --git a/kong/plugins/tcp-log/schema.lua b/kong/plugins/tcp-log/schema.lua index a8b5661b806..9f0356acefa 100644 --- a/kong/plugins/tcp-log/schema.lua +++ b/kong/plugins/tcp-log/schema.lua @@ -5,6 +5,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { host = typedefs.host({ required = true }), }, { port = typedefs.port({ required = true }), }, diff --git a/kong/plugins/udp-log/schema.lua b/kong/plugins/udp-log/schema.lua index 294e38a60b0..8b21a44a152 100644 --- a/kong/plugins/udp-log/schema.lua +++ b/kong/plugins/udp-log/schema.lua @@ -5,6 +5,7 @@ return { fields = { { config = { type = "record", + nullable = false, fields = { { host = typedefs.host({ required = true }) }, { port = typedefs.port({ required = true }) },