chore: fix CI failures (#118)

* chore: regenerate formatter and cheatsheets for paginate_with

* chore: fix credo errors

Use pattern matching to remove an if level and invert the logic on the
if Credo was complaining about
This commit is contained in:
Riccardo Binetti 2024-03-22 17:59:21 +01:00 committed by GitHub
parent 51004afa8d
commit 1c47c79081
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 27 deletions

View file

@ -36,6 +36,7 @@ spark_locals_without_parens = [
metadata_names: 1,
metadata_types: 1,
modify_resolution: 1,
paginate_with: 1,
primary_key_delimiter: 1,
read_action: 1,
read_one: 2,

View file

@ -214,6 +214,7 @@ list :list_posts_paginated, :read, relay?: true
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`relay?`](#graphql-queries-list-relay?){: #graphql-queries-list-relay? } | `boolean` | `false` | If true, the graphql queries/resolvers for this resource will be built to honor the relay specification. See [the relay guide](/documentation/topics/relay.html) for more. |
| [`paginate_with`](#graphql-queries-list-paginate_with){: #graphql-queries-list-paginate_with } | `:keyset \| :offset \| nil` | `:keyset` | Determine the pagination strategy to use, if multiple are available. If `nil`, no pagination is applied, otherwise the given strategy is used. |
| [`type_name`](#graphql-queries-list-type_name){: #graphql-queries-list-type_name } | `atom` | | Override the type name returned by this query. Must be set if the read action has `metadata` that is not hidden via the `show_metadata` key. |
| [`metadata_names`](#graphql-queries-list-metadata_names){: #graphql-queries-list-metadata_names } | `keyword` | `[]` | Name overrides for metadata fields on the read action. |
| [`metadata_types`](#graphql-queries-list-metadata_types){: #graphql-queries-list-metadata_types } | `keyword` | `[]` | Type overrides for metadata fields on the read action. |

View file

@ -1277,15 +1277,16 @@ defmodule AshGraphql.Resource do
nil
end
defp pagination_strategy(%{paginate_with: strategy}, action) do
if !action.pagination do
defp pagination_strategy(_query, %{pagination: pagination}) when pagination in [nil, false] do
nil
else
end
defp pagination_strategy(%{paginate_with: strategy}, action) do
strategies =
if !action.pagination.required? do
[nil]
else
if action.pagination.required? do
[]
else
[nil]
end
strategies =
@ -1308,7 +1309,6 @@ defmodule AshGraphql.Resource do
Enum.at(strategies, 0)
end
end
end
defp maybe_wrap_non_null({:non_null, type}, true) do
%Absinthe.Blueprint.TypeReference.NonNull{