From 0ef51ce9e6ed94a212911e5a222d7f88a9d7aed7 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Thu, 18 Mar 2021 23:32:56 -0400 Subject: [PATCH] improvement: trim whitespace in uuid --- lib/ash/type/uuid.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ash/type/uuid.ex b/lib/ash/type/uuid.ex index afe6f99e..d97d5db1 100644 --- a/lib/ash/type/uuid.ex +++ b/lib/ash/type/uuid.ex @@ -11,6 +11,10 @@ defmodule Ash.Type.UUID do def storage_type, do: :binary_id @impl true + def cast_input(value, _) when is_binary(value) do + Ecto.Type.cast(:binary_id, String.trim(value)) + end + def cast_input(value, _) do Ecto.Type.cast(:binary_id, value) end