···22 alias Atex.IdentityResolver.{Cache, DID, DIDDocument, Handle, Identity}
3344 @handle_strategy Application.compile_env(:atex, :handle_resolver_strategy, :dns_first)
55+ @type options() :: {:skip_cache, boolean()}
5667 # TODO: simplify errors
7888- def resolve(identifier) do
99+ @spec resolve(String.t(), list(options())) :: {:ok, Identity.t()} | {:error, any()}
1010+ def resolve(identifier, opts \\ []) do
1111+ opts = Keyword.validate!(opts, skip_cache: false)
1212+ skip_cache = Keyword.get(opts, :skip_cache)
1313+1414+ cache_result = if skip_cache, do: {:error, :not_found}, else: Cache.get(identifier)
1515+916 # If cache fetch succeeds, then the ok tuple will be retuned by the default `with` behaviour
1010- with {:error, :not_found} <- Cache.get(identifier),
1717+ with {:error, :not_found} <- cache_result,
1118 {:ok, identity} <- do_resolve(identifier),
1219 identity <- Cache.insert(identity) do
1320 {:ok, identity}
-2
lib/atex/identity_resolver/did_document.ex
···6868 @spec from_json(map()) :: {:ok, t()} | {:error, Peri.Error.t()}
6969 def from_json(%{} = map) do
7070 map
7171- # TODO: `atomize_keys` instead? Peri doesn't convert nested schemas to atoms but does for the base schema.
7272- # Smells like a PR if I've ever smelt one...
7371 |> Recase.Enumerable.convert_keys(&Recase.to_snake/1)
7472 |> schema()
7573 |> case do