Ash FrameworkAF
Ash Framework3y ago
7 replies
Blibs

Remove/Limit FilterInput and SortInput fields from a specific action in GraphQL

So, let's say I have custom fields that I added to my action to handle filtering and sorting, for example:

    read :read do
      primary? true

      argument :min_price, :decimal, default: nil
      argument :max_price, :decimal, default: nil

      argument :sort_by, :atom
...


If I create a graphQL query from that action, it will contain the FilterInput and SortInput arguments (see image), is there a way to remove this so my query will only be filterable and sortable by the fields I want?

Also, both FilterInput and SortInput seems to basically allow filtering and sorting through all the fields that my resource returns. Is there some way that I can limit that for a specific action somehow?

For example, I would like to actually remove the :min_price and :max_price arguments from my action and make FilterInput only support the initialPrice (which is the field that these two arguments compare with).
image.png
Was this page helpful?