Skip to content

Commit 8adcfd8

Browse files
committed
Add compile time check is there geo url module or not
1 parent c634356 commit 8adcfd8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/macros/guarded_struct/derive/validation_derive.ex

+4-2
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,10 @@ defmodule MishkaDeveloperTools.Macros.GuardedStruct.Derive.ValidationDerive do
293293
end
294294
end
295295

296-
def validate(:geo_url, input, field) do
297-
location("geo:#{input}", field, :geo_url)
296+
if Code.ensure_loaded?(URL) do
297+
def validate(:geo_url, input, field) do
298+
location("geo:#{input}", field, :geo_url)
299+
end
298300
end
299301

300302
if Code.ensure_loaded?(EmailChecker) do

0 commit comments

Comments
 (0)