You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Erlang RPC presents a problem for rolling upgrades, where one release may have changes to the RPC functions. I'd like to use proper_types:is_inst/2 during testing when rpc is called and validate that a module, function exists and is expecting the arguments according to a proper raw_type schema.
For example, very simplified:
call(Mod, Fun, Args) ->
ValidRPCs = [
% {Key, RawTypes} when Key :: {Module, Function, Arity}
{{my_module, my_fun_v1, 1}, [list(atom())]},
{{my_module, my_otherfun_v1, 2}, [integer(), integer()]}
],
{_Key, RawTypes} = lists:keyfind({Mod, Fun, length(Args)}, 1, ValidRPCs),
true = lists:all(fun(Value, RawType) -> is_inst(Value, RawType) end, lists:zip(Args, RawTypes)),
% continue_with_call or crash to let me know the API has a braking change
The other issue is that proper type any() is not erlang any() or term(), it fails with missing types like pid(). It would be really great to add more missing types, even if for validation only, but a catchall to ignore missing types would suffice to catch the rest. I've added an ignore() and pid() types locally to test and it worked.
Please let me know if this use can can be accommodated.
The text was updated successfully, but these errors were encountered:
currently
proper_types:is_inst/2
is marked as @Privateproper/src/proper_types.erl
Line 422 in d42964b
Erlang RPC presents a problem for rolling upgrades, where one release may have changes to the RPC functions. I'd like to use
proper_types:is_inst/2
during testing when rpc is called and validate that a module, function exists and is expecting the arguments according to a proper raw_type schema.For example, very simplified:
The other issue is that proper type any() is not erlang any() or term(), it fails with missing types like pid(). It would be really great to add more missing types, even if for validation only, but a catchall to ignore missing types would suffice to catch the rest. I've added an ignore() and pid() types locally to test and it worked.
Please let me know if this use can can be accommodated.
The text was updated successfully, but these errors were encountered: