-
-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Code of Conduct
- I agree to follow this project's Code of Conduct
AI Policy
- I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Versions
elixir 1.19
erlang 28
ash spark latest
Operating system
mac
Current Behavior
h Spark.Options.Validator
defmodule MyOptions do
use Spark.Options.Validator, schema: [
foo: [
type: :string,
required: true
],
bar: [
type: :string
],
baz: [
type: :integer,
default: 10
]
]
end
options = MyOptions.validate!(foo: "hello", baz: 20)
{:error, error} = MyOptions.validate(bar: 123)The validate error message as below(the type of :bar is string):
{:error,
%Spark.Options.ValidationError{
message: "invalid value for :bar option: expected integer, got: 123",
key: :bar,
value: 123,
keys_path: []
}}Expected Behavior
The validate error message should as below:
{:error,
%Spark.Options.ValidationError{
message: "invalid value for :bar option: expected string, got: 123",
key: :bar,
value: 123,
keys_path: []
}}Should change the code https://github.com/ash-project/spark/blob/main/lib/spark/options/validator.ex#L248
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working