Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ justify-*.tar

# Ignore macOS directory config.
.DS_Store

# ignore .mix_tasks (used for fast autocomplete on shell)
.mix_tasks
3 changes: 2 additions & 1 deletion lib/justify.ex
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ defmodule Justify do
as: :call

@doc """
Validates that one or more fields has a value.
Validates that one or more fields is not empty. This means they are neither
the empty string `""` nor they are `nil`.

## Options

Expand Down
4 changes: 4 additions & 0 deletions lib/justify/validators/length.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ defmodule Justify.Validators.Length do
check(:list, length(value), opts)
end

defp validate(_value, _opts) do
nil
end

defp check(type, len, %{ is: count } = opts) when len != count do
message = Map.get(opts, :message, get_in(@default_message, [type, :is]))

Expand Down
5 changes: 3 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ defmodule Justify.MixProject do

defp deps do
[
{ :dialyxir, "~> 1.1.0", only: :dev, runtime: false },
{ :ex_doc, ">= 0.0.0", only: :dev, runtime: false }
{:dialyxir, "~> 1.1.0", only: :dev, runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:stream_data, "~> 0.4.3", onle: [:dev, :test]}
]
end

Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
"makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"},
"stream_data": {:hex, :stream_data, "0.4.3", "62aafd870caff0849a5057a7ec270fad0eb86889f4d433b937d996de99e3db25", [:mix], [], "hexpm", "7dafd5a801f0bc897f74fcd414651632b77ca367a7ae4568778191fc3bf3a19a"},
}
Loading