@ozziexsh
Would be nice to have an option to fail the validation when extra keys/data present than in the rules. It will be useful in the test case assertions to ensure API does not return any unwanted/protected data. Same for incoming requests also, it would be nice to inform the client when unsupported keys are given than ignoring them.
Without option
{ok, data} = Validate.validate(%{name: "joe", age: 30}, %{name: [type: string]})
data == %{name: "joe"}
With option, something like
{:error, _} = Validate.validate(%{name: "joe", age: 30}, %{name: [type: string]}, %{unknown: :reject})
# age not allowed
Your thoughts ?
@ozziexsh
Would be nice to have an option to fail the validation when extra keys/data present than in the rules. It will be useful in the test case assertions to ensure API does not return any unwanted/protected data. Same for incoming requests also, it would be nice to inform the client when unsupported keys are given than ignoring them.
Without option
With option, something like
Your thoughts ?