improvement: fix lint/credo/versions

This commit is contained in:
Zach Daniel 2022-04-26 11:35:09 -04:00
parent e2d35f8a8c
commit 8ed9938201
8 changed files with 27 additions and 30 deletions

View file

@ -74,8 +74,6 @@ defmodule AshGraphql do
AshGraphql.Api.type_definitions(api, __MODULE__, false)
end
Enum.filter(type_definitions, &is_nil(&1.__reference__))
new_defs =
List.update_at(blueprint_with_mutations.schema_definitions, 0, fn schema_def ->
%{

View file

@ -707,9 +707,8 @@ defmodule AshGraphql.Resource do
resource
|> Ash.Resource.Info.public_attributes()
|> Enum.filter(fn attribute ->
is_nil(action.accept) || attribute.name in action.accept
(is_nil(action.accept) || attribute.name in action.accept) && attribute.writable?
end)
|> Enum.filter(& &1.writable?)
|> Enum.map(fn attribute ->
allow_nil? =
attribute.allow_nil? || attribute.default != nil || type == :update ||
@ -1823,10 +1822,9 @@ defmodule AshGraphql.Resource do
{:array, _} ->
true
_ ->
false
attribute ->
Ash.Type.embedded_type?(attribute.type)
end)
|> Enum.reject(&Ash.Type.embedded_type?/1)
|> Enum.flat_map(fn attribute ->
[
%Absinthe.Blueprint.Schema.FieldDefinition{
@ -2010,10 +2008,9 @@ defmodule AshGraphql.Resource do
%{type: {:array, _}} ->
true
_ ->
false
attribute ->
Ash.Type.embedded_type?(attribute.type)
end)
|> Enum.reject(&Ash.Type.embedded_type?(&1.type))
|> Enum.map(& &1.name)
aggregate_sort_values =

View file

@ -83,7 +83,7 @@ defmodule AshGraphql.MixProject do
[
{:ash, ash_version("~> 1.50")},
{:absinthe_plug, "~> 1.4"},
{:absinthe, path: "deps/absinthe", override: true},
{:absinthe, "~> 1.7"},
{:dataloader, "~> 1.0"},
{:jason, "~> 1.2"},
{:ex_doc, "~> 0.22", only: :dev, runtime: false},

View file

@ -1,5 +1,5 @@
%{
"absinthe": {:hex, :absinthe, "1.5.5", "22b26228f56dc6a1074c52cea9c64e869a0cb2427403bcf9056c422d36c66292", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "41e79ed4bffbab4986493ff4120c948d59871fd08ad5e31195129ce3c01aad58"},
"absinthe": {:hex, :absinthe, "1.7.0", "36819e7b1fd5046c9c734f27fe7e564aed3bda59f0354c37cd2df88fd32dd014", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0 or ~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "566a5b5519afc9b29c4d367f0c6768162de3ec03e9bf9916f9dc2bcbe7c09643"},
"absinthe_plug": {:hex, :absinthe_plug, "1.5.5", "be913e77df1947ffb654a1cf1a90e28d84dc23241f6404053750bae513ccd52b", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "6c366615d9422444774206aff3448bb9cfb4e849e0c9a94a275085097bc67509"},
"ash": {:hex, :ash, "1.50.16", "11fb1d4f761b9e9cf3e6d5f5910a330381cb0c5e35b574d207f20f06afbb9faa", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8.0", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.5", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: false]}, {:timex, ">= 3.0.0", [hex: :timex, repo: "hexpm", optional: false]}], "hexpm", "47813d5da2f209fc98f55a793777ec9f24a02dcd386898d3716ed919ac212818"},
"ashton": {:hex, :ashton, "0.4.1", "d0f7782ac44fa22da7ce544028ee3d2078592a834d8adf3e5b4b6aeb94413a55", [:mix], [], "hexpm", "24db667932517fdbc3f2dae777f28b8d87629271387d4490bc4ae8d9c46ff3d3"},
@ -7,12 +7,12 @@
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
"comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"},
"credo": {:hex, :credo, "1.5.5", "e8f422026f553bc3bebb81c8e8bf1932f498ca03339856c7fec63d3faac8424b", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "dd8623ab7091956a855dc9f3062486add9c52d310dfd62748779c4315d8247de"},
"credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"},
"dataloader": {:hex, :dataloader, "1.0.10", "a42f07641b1a0572e0b21a2a5ae1be11da486a6790f3d0d14512d96ff3e3bbe9", [:mix], [{:ecto, ">= 3.4.3 and < 4.0.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.0 or ~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "54cd70cec09addf4b2ace14cc186a283a149fd4d3ec5475b155951bf33cd963f"},
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
"dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},
"earmark_parser": {:hex, :earmark_parser, "1.4.12", "b245e875ec0a311a342320da0551da407d9d2b65d98f7a9597ae078615af3449", [:mix], [], "hexpm", "711e2cc4d64abb7d566d43f54b78f7dc129308a63bc103fbd88550d2174b3160"},
"ecto": {:hex, :ecto, "3.7.2", "44c034f88e1980754983cc4400585970b4206841f6f3780967a65a9150ef09a8", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a600da5772d1c31abbf06f3e4a1ffb150e74ed3e2aa92ff3cee95901657a874e"},
"ecto": {:hex, :ecto, "3.8.0", "69cb6c9d58f28efd7990982a170c7f3b502933c4cafd16878d1a944b788d659c", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5393e6cdc3c47b5e8fa51554ae091509ae7e339b2dfe4cd00874cd62af35723a"},
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ets": {:hex, :ets, "0.8.1", "8ff9bcda5682b98493f8878fc9dbd990e48d566cba8cce59f7c2a78130da29ea", [:mix], [], "hexpm", "6be41b50adb5bc5c43626f25ea2d0af1f4a242fb3fad8d53f0c67c20b78915cc"},

View file

@ -1,4 +1,5 @@
defmodule AshGraphql.Test.Registry do
@moduledoc false
use Ash.Registry
entries do

View file

@ -23,24 +23,24 @@ defmodule AshGraphql.Test.DoubleRelRecursive do
relationships do
belongs_to :double_rel, DoubleRelToRecursiveParentOfEmbed do
source_field :double_rel_id
required? true
source_field(:double_rel_id)
required?(true)
end
belongs_to :myself, DoubleRelRecursive do
source_field :recursive_id
required? false
private? true
source_field(:recursive_id)
required?(false)
private?(true)
end
has_many :first_rel, DoubleRelRecursive do
destination_field :recursive_id
filter expr(type == :first)
destination_field(:recursive_id)
filter(expr(type == :first))
end
has_many :second_rel, DoubleRelRecursive do
destination_field :recursive_id
filter expr(type == :second)
destination_field(:recursive_id)
filter(expr(type == :second))
end
end
end

View file

@ -1,4 +1,3 @@
defmodule AshGraphql.Test.DoubleRelToRecursiveParentOfEmbed do
@moduledoc false
@ -9,7 +8,7 @@ defmodule AshGraphql.Test.DoubleRelToRecursiveParentOfEmbed do
alias AshGraphql.Test.DoubleRelRecursive
attributes do
uuid_primary_key :id
uuid_primary_key(:id)
attribute(:dummy, :string, default: "Dummy")
end
@ -20,7 +19,7 @@ defmodule AshGraphql.Test.DoubleRelToRecursiveParentOfEmbed do
relationships do
has_many :all, DoubleRelRecursive do
destination_field :double_rel_id
destination_field(:double_rel_id)
end
end
end

View file

@ -1,8 +1,10 @@
defmodule AshGraphql.Test.DoubleRelType do
use Ash.Type.Enum, values: [
:first,
:second,
]
@moduledoc false
use Ash.Type.Enum,
values: [
:first,
:second
]
def graphql_type, do: :double_rel_type
end