From f0c1a0f3530acf3dd94d07e331c8b685c275936b Mon Sep 17 00:00:00 2001 From: Ashlynne Mitchell Date: Sat, 11 Apr 2026 20:25:28 +1000 Subject: [PATCH] refactor: test CIDs against :dasl library --- lib/atex/lexicon/validators/string.ex | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/atex/lexicon/validators/string.ex b/lib/atex/lexicon/validators/string.ex index 0f8c3cb..e5a6901 100644 --- a/lib/atex/lexicon/validators/string.ex +++ b/lib/atex/lexicon/validators/string.ex @@ -53,11 +53,8 @@ defmodule Atex.Lexicon.Validators.String do do: Validators.boolean_validate(Atex.AtURI.match?(value), "should be a valid at:// URI") defp validate_option(value, {:format, "cid"}) do - # TODO: is there a regex provided by the lexicon docs/somewhere? - try do - Multiformats.CID.decode(value) - :ok - rescue + case DASL.CID.new(value) do + {:ok, _} -> :ok _ -> {:error, "should be a valid CID", []} end end -- 2.51.2