mirror of
https://github.com/sloanelybutsurely/typeid-elixir.git
synced 2024-11-28 01:42:54 -05:00
Fix prefix validation in Ecto type (#35)
This commit is contained in:
parent
c74d433c2d
commit
1e4d1f8aee
2 changed files with 2 additions and 5 deletions
|
@ -263,7 +263,7 @@ defmodule TypeID do
|
|||
ArgumentError -> :error
|
||||
end
|
||||
|
||||
defp validate_prefix!(prefix) do
|
||||
def validate_prefix!(prefix) do
|
||||
cond do
|
||||
String.starts_with?(prefix, "_") ->
|
||||
invalid_prefix!(prefix, "cannot start with an underscore")
|
||||
|
|
|
@ -89,10 +89,7 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
|
|||
prefix = Keyword.get(opts, :prefix)
|
||||
|
||||
if primary_key do
|
||||
unless prefix && prefix =~ ~r/^[a-z]{0,63}$/ do
|
||||
raise ArgumentError,
|
||||
"must specify `prefix` using only lowercase letters between 0 and 63 characters long."
|
||||
end
|
||||
TypeID.validate_prefix!(prefix)
|
||||
end
|
||||
|
||||
unless type in ~w[string binary]a do
|
||||
|
|
Loading…
Reference in a new issue