From 5eaec735f89d1497487721638d6617c2d3329af3 Mon Sep 17 00:00:00 2001 From: Jechol Lee Date: Fri, 12 Jan 2024 01:44:04 +0900 Subject: [PATCH] fix: fix typespecs and cleanup Ash.Resource.Builder (#827) --- lib/ash/resource/builder.ex | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/ash/resource/builder.ex b/lib/ash/resource/builder.ex index 04e8f68e..3820edc3 100644 --- a/lib/ash/resource/builder.ex +++ b/lib/ash/resource/builder.ex @@ -114,14 +114,12 @@ defmodule Ash.Resource.Builder do ) :: {:ok, Ash.Resource.Relationships.relationship()} | {:error, term} def build_relationship(type, name, destination, opts \\ []) do - with {:ok, opts} <- handle_nested_builders(opts, [:changes, :arguments, :metadata]) do - Transformer.build_entity( - Ash.Resource.Dsl, - [:relationships], - type, - Keyword.merge(opts, name: name, destination: destination) - ) - end + Transformer.build_entity( + Ash.Resource.Dsl, + [:relationships], + type, + Keyword.merge(opts, name: name, destination: destination) + ) end @doc """ @@ -166,16 +164,14 @@ defmodule Ash.Resource.Builder do fields :: atom | list(atom), opts :: Keyword.t() ) :: - {:ok, Ash.Resource.Relationships.relationship()} | {:error, term} + {:ok, Ash.Resource.Identity.t()} | {:error, term} def build_identity(name, fields, opts \\ []) do - with {:ok, opts} <- handle_nested_builders(opts, [:changes, :arguments, :metadata]) do - Transformer.build_entity( - Ash.Resource.Dsl, - [:identities], - :identity, - Keyword.merge(opts, name: name, keys: fields) - ) - end + Transformer.build_entity( + Ash.Resource.Dsl, + [:identities], + :identity, + Keyword.merge(opts, name: name, keys: fields) + ) end @doc """ @@ -288,7 +284,7 @@ defmodule Ash.Resource.Builder do Builds a calculation argument """ @spec build_calculation_argument(name :: atom, type :: Ash.Type.t(), opts :: Keyword.t()) :: - {:ok, Ash.Resource.Actions.Argument.t()} | {:error, term} + {:ok, Ash.Resource.Calculation.Argument.t()} | {:error, term} def build_calculation_argument(name, type, opts \\ []) do Transformer.build_entity( Ash.Resource.Dsl,