-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hey 👋
Thanks for a nice & clean library.
One question (pardon if a silly one) is about this callback definitions:
defmodule Fsmx.Fsm do
...
if Code.ensure_loaded?(Ecto) do
@callback transition_changeset(struct, Fsmx.state_t, Fsmx.state_t) :: Ecto.Changeset.t()
@callback after_transition_multi(struct, Fsmx.state_t, Fsmx.state_t) ::
{:ok, struct} | {:error, any}
end
...
I thought the idea was to use @impl when overriding transition_changeset, like here:
defmodule App.StateMachineSchema do
# ...
@impl Fsmx.Fsm
def transition_changeset(changeset, "one", "two", params) do
# changeset already includes a :state field change
changeset
|> cast(params, [:data])
|> validate_required([:data])
end
but transition_changeset above accepts 4 params, while callback defines only 3 params.
Also there's no @behaviour in defmacro __using__.
This is not a bug report - just curious what was the original intent around @callback 🙏
Metadata
Metadata
Assignees
Labels
No labels