Change :transform() return values to match tableshape behavior:
- Success: return value (not true, value)
- Failure: return nil, error (not false, error)
This is required for compatibility with lua_selectors check_args which
expects the tableshape return convention. The :check() method still
returns (bool, value_or_error) for new code.
end,
-- Transform value according to schema
+ -- Returns: (value) on success, (nil, error) on failure (tableshape-compatible)
transform = function(self, value, ctx)
ctx = ctx or make_context("transform")
- return self._check(self, value, ctx)
+ local ok, result = self._check(self, value, ctx)
+ if ok then
+ return result
+ else
+ return nil, result
+ end
end,
-- Make schema optional