From d51e1a018221225230d4907f2a91453197b22ec6 Mon Sep 17 00:00:00 2001 From: Xiaochen Wang Date: Mon, 20 Jan 2025 18:20:11 +0800 Subject: [PATCH] remove unncessary logic --- kong/db/schema/others/declarative_config.lua | 28 +++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/kong/db/schema/others/declarative_config.lua b/kong/db/schema/others/declarative_config.lua index 31024b9264d..4ab298acfb8 100644 --- a/kong/db/schema/others/declarative_config.lua +++ b/kong/db/schema/others/declarative_config.lua @@ -844,7 +844,15 @@ local function get_unique_key(schema, entity, field, value) end -function DeclarativeConfig.validate_schema(self, input) +local function flatten(self, input) + -- manually set transform here + -- we can't do this in the schema with a `default` because validate + -- needs to happen before process_auto_fields, which + -- is the one in charge of filling out default values + if input._transform == nil then + input._transform = true + end + local ok, err = self:validate(input) if not ok then yield() @@ -867,24 +875,6 @@ function DeclarativeConfig.validate_schema(self, input) yield() end - return true -end - - -local function flatten(self, input) - -- manually set transform here - -- we can't do this in the schema with a `default` because validate - -- needs to happen before process_auto_fields, which - -- is the one in charge of filling out default values - if input._transform == nil then - input._transform = true - end - - local ok, err = DeclarativeConfig.validate_schema(self, input) - if not ok then - return nil, err - end - generate_ids(input, self.known_entities) yield()