Is your feature request related to a problem? Please describe.
It can be pretty easy to get provide invalid argument or attribute names when defining a code_interface, especially after refactoring. This seems like something we might be able to check at compile time.
Example
defmodule MyResource do
use Ash.Resource, ...
resource do
require_primary_key? false
end
code_interface do
define :set, args: [:keys, :value] # <--- Should be :key, :value but no error is raised at compile time
end
actions do
create :set do
accept [:key, :value]
...
end
end
attributes do
attribute :key, :atom
attribute :value, :integer
end
end
defmodule MyDomain do
use Ash.Domain
resources do
resource MyResource do
define :set, args: [:keys, :value] # <--- Should be :key, :value but no error is raised at compile time
end
end
Describe the solution you'd like
A compile-time error when these kind of mistakes are made, telling the user that the code interface will fail.
Bonus points if we can tell them "did you mean :key instead of :keys?"
Is your feature request related to a problem? Please describe.
It can be pretty easy to get provide invalid argument or attribute names when defining a
code_interface
, especially after refactoring. This seems like something we might be able to check at compile time.Example
Describe the solution you'd like
A compile-time error when these kind of mistakes are made, telling the user that the code interface will fail.
Bonus points if we can tell them "did you mean :key instead of :keys?"