Skip to content

Commit 32dc074

Browse files
mayeljonasschmidt
authored andcommitted
Update format.ex
addresses #93
1 parent 176de8d commit 32dc074

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/ex_json_schema/validator/format.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule ExJsonSchema.Validator.Format do
1313

1414
@behaviour ExJsonSchema.Validator
1515

16-
@formats %{
16+
defp formats, do: %{
1717
"email" => ~r<^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[\w!#$%&'*+/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\.)+[a-z]{2,}$>i,
1818
"hostname" => ~r/^[\pL0-9](?:[\pL0-9-]{0,61}[\pL0-9])?(?:\.[\pL0-9](?:[-0-9\pL]{0,61}[0-9\pL])?)*$/iu,
1919
"idn-email" => ~r<^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[\w!#$%&'*+/=?`{|}~^-]+)*@(?:[\pL0-9-]+\.)+[\pL]{2,6}$>iu,
@@ -83,7 +83,7 @@ defmodule ExJsonSchema.Validator.Format do
8383
"uri",
8484
"uri-template"
8585
] do
86-
case Regex.match?(@formats[format], data) do
86+
case Regex.match?(formats()[format], data) do
8787
true -> []
8888
false -> [%Error{error: %Error.Format{expected: format}}]
8989
end

0 commit comments

Comments
 (0)