diff --git a/src/resty/aws/init.lua b/src/resty/aws/init.lua index 8422a52..92e79fb 100644 --- a/src/resty/aws/init.lua +++ b/src/resty/aws/init.lua @@ -303,13 +303,16 @@ local function generate_service_methods(service) method_name) service[method_name] = function(self, params) + params = params or {} --print(require("pl.pretty").write(self.config)) - -- validate parameters - local ok, err = validate_input(params, operation.input, "params") - if not ok then - return nil, operation_prefix .. " validation error: " .. tostring(err) + -- validate parameters if we have any; eg. S3 "listBuckets" has none + if operation.input then + local ok, err = validate_input(params, operation.input, "params") + if not ok then + return nil, operation_prefix .. " validation error: " .. tostring(err) + end end -- implement stsRegionalEndpoints config setting, diff --git a/src/resty/aws/request/build.lua b/src/resty/aws/request/build.lua index 6ed96a2..d2bcef2 100644 --- a/src/resty/aws/request/build.lua +++ b/src/resty/aws/request/build.lua @@ -157,7 +157,7 @@ local function build_request(operation, config, params) -- inject parameters in the right places; path/query/header/body -- this assumes they all live on the top-level of the structure, is this correct?? - for name, member_config in pairs(operation.input.members) do + for name, member_config in pairs((operation.input or {}).members or {}) do local param_value = params[name] -- TODO: date-time value should be properly formatted??? if param_value ~= nil then