I just updated to Ash 3.0 here are my versions:
{:ash, "~> 3.0.0-rc.29"},
{:ash_postgres, "~> 2.0.0-rc.11"},
{:ash_phoenix, "~> 2.0.0-rc.7"},
{:ash_authentication, "~> 4.0.0-rc.6"},
{:ash_authentication_phoenix, "~> 2.0.0-rc.2"},
{:ash_graphql, "~> 1.0.0-rc.3"}
I have a Company
Resource with attributes of id, name, and domain.
And I’ve set the default accept on actions to :*
actions do
default_accept :*
defaults [:create, :read, :update, :destroy]
And the following GraphQL configuration:
graphql do
type :company
queries do
list :list_companies, :read, paginate_with: nil
get :exists, :by_domain
get :company_by_id, :by_id
end
mutations do
end
end
By default, list companies works with pagination. When paginate_with: nil
the generated schema shows that it should return [Company!]! like you would expect but when I call the query via GraqhQL I get an error that seems like it’s still trying to use pagination somewhere:
[error] 3bd03236-83ff-4ca6-9a20-8e8ffdf15eab: Exception raised while resolving query.
** (KeyError) key :name not found in: %{
count: %Absinthe.Type.Field{
identifier: :count,
name: “count”,
description: “Total count on all pages”,
type: :integer,
deprecation: nil,
args: %{},
config: nil,
triggers: ,
middleware: [{Absinthe.Middleware.MapGet, :count}],
complexity: nil,
default_value: nil,
private: ,
definition: App.GraphqlSchema,
reference: %{
module: AshGraphql.Resource,
location: %{
line: 3296,
file: “/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex”
}
}
},
results: %Absinthe.Type.Field{
identifier: :results,
name: “results”,
description: “The records contained in the page”,
type: %Absinthe.Type.List{
of_type: %Absinthe.Type.NonNull{of_type: :company}
},
deprecation: nil,
args: %{},
config: nil,
triggers: ,
middleware: [{Absinthe.Middleware.MapGet, :results}],
complexity: nil,
default_value: nil,
private: ,
definition: App.GraphqlSchema,
reference: %{
module: AshGraphql.Resource,
location: %{
line: 3396,
file: “/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex”
}
}
},
start_keyset: %Absinthe.Type.Field{
identifier: :start_keyset,
name: “start_keyset”,
description: “The first keyset in the results”,
type: :string,
deprecation: nil,
args: %{},
config: nil,
triggers: ,
middleware: [{Absinthe.Middleware.MapGet, :start_keyset}],
complexity: nil,
default_value: nil,
private: ,
definition: App.GraphqlSchema,
reference: %{
module: AshGraphql.Resource,
location: %{
line: 3409,
file: “/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex”
}
}
},
end_keyset: %Absinthe.Type.Field{
identifier: :end_keyset,
name: “end_keyset”,
description: "The last k:erlang.map_get(:name, %{count: %Absinthe.Type.Field{identifier: :count, name: "count", description: "Total count on all pages", type: :integer, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :count}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3296, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, results: %Absinthe.Type.Field{identifier: :results, name: "results", description: "The records contained in the page", type: %Absinthe.Type.List{of_type: %Absinthe.Type.NonNull{of_type: :company}}, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :results}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3396, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, start_keyset: %Absinthe.Type.Field{identifier: :start_keyset, name: "start_keyset", description: "The first keyset in the results", type: :string, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :start_keyset}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3409, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, end_keyset: %Absinthe.Type.Field{identifier: :end_keyset, name: "end_keyset", description: "The last keyset in the results", type: :string, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :end_keyset}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3417, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, __typename: %Absinthe.Type.Field{identifier: :__typename, name: "__typename", description: "The name of the object type currently being queried.", type: :string, deprecation: nil, args: %{}, config: 0, triggers: %{}, middleware: [{{Absinthe.Middleware, :shim}, {:keyset_page_of_company, :__typename, [{:ref, Absinthe.Phase.Schema.Introspection, :typename}]}}], complexity: 0, default_value: nil, __private__: [], definition: Absinthe.Phase.Schema.Introspection, __reference__: %{module: Absinthe.Phase.Schema.Introspection, location: %{line: 74, file: "/Users/bryan/one-dashboard/app/deps/absinthe/lib/absinthe/phase/schema/introspection.ex"}}}}) (absinthe 1.7.6) lib/absinthe/resolution/projector.ex:136: Absinthe.Resolution.Projector.update_schema_node/2 (absinthe 1.7.6) lib/absinthe/resolution/projector.ex:53: Absinthe.Resolution.Projector.do_collect/6 (absinthe 1.7.6) lib/absinthe/resolution/projector.ex:41: Absinthe.Resolution.Projector.collect/3 (absinthe 1.7.6) lib/absinthe/resolution/projector.ex:29: Absinthe.Resolution.Projector.project/5 (absinthe 1.7.6) lib/absinthe/resolution.ex:190: Absinthe.Resolution.project/2 (ash_graphql 1.0.0-rc.3) lib/graphql/resolver.ex:763: AshGraphql.Graphql.Resolver.validate_resolve_opts/6 (ash_graphql 1.0.0-rc.3) lib/graphql/resolver.ex:425: AshGraphql.Graphql.Resolver.resolve/2 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3 (absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3 (absinthe 1.7.6) lib/absinthe/pipeline.ex:408: Absinthe.Pipeline.run_phase/3 (absinthe_plug 1.5.8) lib/absinthe/plug.ex:536: Absinthe.Plug.run_query/4 (absinthe_plug 1.5.8) lib/absinthe/plug.ex:290: Absinthe.Plug.call/2 (phoenix 1.7.12) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2 (phoenix 1.7.12) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5