Nobilta commented on PR #10008: URL: https://github.com/apache/apisix/pull/10008#issuecomment-1715117952
@shreemaan-abhishek @jiangfucheng we can modify check_schema function in traffic-split.lua and add the validating function.  `function _M.check_schema(conf) local ok, err = core.schema.check(schema, conf) if not ok then return false, err end if conf.rules then for _, rule in ipairs(conf.rules) do if rule.match then for _, m in ipairs(rule.match) do local ok, err = expr.new(m.vars) if not ok then return false, "failed to validate the 'vars' expression: " .. err end end end if rule.weighted_upstreams then for _, wupstream in ipairs(rule.weighted_upstreams) do local ups_id = wupstream.upstream_id if ups_id then local ups = upstream.get_by_id(ups_id) core.log.error("upstream:", ups) if not ups then return false, "failed to fetch upstream info by " .. "upstream id: " .. ups_id end end end end end end return true end` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
