-
-
Notifications
You must be signed in to change notification settings - Fork 87
fix: resolve NewType subtype_of matching for filter args #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zachdaniel
merged 1 commit into
ash-project:main
from
nallwhy:fix/newtype-subtype-filter-operator-matching
Mar 5, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # SPDX-FileCopyrightText: 2020 ash_graphql contributors <https://github.com/ash-project/ash_graphql/graphs/contributors> | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
nallwhy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| defmodule AshGraphql.Test.DataLayer.EtsWithFunctions do | ||
| @moduledoc false | ||
| @behaviour Ash.DataLayer | ||
|
|
||
| @ets_with_functions %Spark.Dsl.Section{ | ||
| name: :ets_with_functions, | ||
| describe: "ETS data layer with custom functions for testing", | ||
| schema: [ | ||
| private?: [ | ||
| type: :boolean, | ||
| default: false | ||
| ], | ||
| table: [ | ||
| type: :atom | ||
| ], | ||
| repo: [ | ||
| type: :atom, | ||
| doc: "A fake repo option to simulate AshPostgres pattern" | ||
| ] | ||
| ] | ||
| } | ||
|
|
||
| use Spark.Dsl.Extension, | ||
| sections: [@ets_with_functions] | ||
|
|
||
| @impl true | ||
| defdelegate can?(resource, feature), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate resource_to_query(resource, domain), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate limit(query, limit, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate offset(query, offset, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate add_calculations(query, calculations, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate add_aggregate(query, aggregate, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate set_tenant(resource, query, tenant), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate set_context(resource, query, context), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate select(query, select, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate filter(query, filter, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate sort(query, sort, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate distinct(query, distinct, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate distinct_sort(query, distinct_sort, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate run_query(query, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate run_aggregate_query(query, aggregates, resource), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate create(resource, changeset), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate destroy(resource, changeset), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate update(resource, changeset), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate combination_of(combinations, resource, domain), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate prefer_lateral_join_for_many_to_many?, to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| defdelegate calculate(resource, expressions, context), to: Ash.DataLayer.Ets | ||
|
|
||
| @impl true | ||
| def functions(resource) do | ||
| # Simulate AshPostgres pattern: access a DSL option, then call a method on it | ||
| # AshPostgres does: AshPostgres.DataLayer.Info.repo(resource, :mutate).config() | ||
| repo = Spark.Dsl.Extension.get_opt(resource, [:ets_with_functions], :repo, nil, true) | ||
|
|
||
| if repo do | ||
| _config = repo.config() | ||
| end | ||
|
|
||
| [AshGraphql.Test.Functions.TestILike] | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # SPDX-FileCopyrightText: 2020 ash_graphql contributors <https://github.com/ash-project/ash_graphql/graphs/contributors> | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
nallwhy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| defmodule AshGraphql.Test.TagWithIlike do | ||
| @moduledoc false | ||
|
|
||
| use Ash.Resource, | ||
| domain: AshGraphql.Test.Domain, | ||
| data_layer: AshGraphql.Test.DataLayer.EtsWithFunctions, | ||
| extensions: [AshGraphql.Resource] | ||
|
|
||
| graphql do | ||
| type(:tag_with_ilike) | ||
|
|
||
| filterable_fields [:name, label: [:eq, :ilike]] | ||
|
|
||
| queries do | ||
| list :get_tags_with_ilike, :read | ||
| end | ||
| end | ||
|
|
||
| actions do | ||
| default_accept(:*) | ||
| defaults([:read, :create]) | ||
| end | ||
|
|
||
| attributes do | ||
| uuid_primary_key(:id) | ||
|
|
||
| attribute(:name, :string, public?: true) | ||
| attribute(:label, AshGraphql.Types.StringNewType, public?: true) | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # SPDX-FileCopyrightText: 2020 ash_graphql contributors <https://github.com/ash-project/ash_graphql/graphs/contributors> | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
nallwhy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| defmodule AshGraphql.Test.Functions.TestILike do | ||
| @moduledoc false | ||
| use Ash.Query.Function, name: :ilike, predicate?: true | ||
|
|
||
| def args, do: [[:string, :string]] | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.