Ash Framework

AF

Ash Framework

The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.

Join

support

showcase

today-i-learned

Suggestion broken with latest ElixirSense

Hi @Zach Daniel, I've found a bug using Spark autocomplete suggestion in vscode with latest ElixirSense release. Issue here https://github.com/ash-project/spark/issues/54 and tried to fix that with a PR here https://github.com/ash-project/spark/pull/55...

GraphQL NewType Non-null?

I'm surfacing a calculated map as its own type in GraphQL and trying to make the fields non-nullable, but can't seem to get it working. I've also tried dropping the allow_nil?s into constraints key. Am I holding it wrong? ```elixir defmodule MyApp.Types.LatLng do use Ash.Type.NewType,...
No description

Filtering by enum attribute

I have an Ash resource that has an enum field status. Im using AshJsonApi to pass in a filter: filter[status]=active,incomplete. This doesnt seem to work out of the box so I implemented a preperation where I do this: ```elixir defp filter_by_status(query) do case Ash.Changeset.get_argument(query, :filter) do %{"status" => statuses} ->...

Notifications warning in migration

I'm getting a warning [warning] Missed 1 notifications in action GF.WebComponents.WebSite.update in the logs when running a new migration that calls an :update action on a resource. I know very little about Ash notifications and how they work. I don't want to disable them globally, because they might be useful in the future. How can I prevent this warning from appearing when the migration runs? ``` 12:39:17.050 [warning] Missed 1 notifications in action GF.WebComponents.WebSite.update. ...

Is there a way to define dsl for new type of attribute?

I've implemented ULID type which is one of alternatives to UUID. I can use it without a problem right now by providing type and default to uuid_primary_key. But wanted to venture into making a small spark extension that adds ulid_primary_key. With my naive approach I wrote something like that: ```elixir defmodule Ash.Ulid.Extension do...

Duplicate input types for GraphQL

Given a resource like this ```elixir defmodule Package attributes do...

Create action commits changes even if return fails due to field policy

Hey @Zach Daniel and @barnabasj j, I noticed a behavior that I'm not sure if it is a rbac bug, an Ash bug or if it is not a bug at all and is by design. I have a resource that I forgot to add the fields field policy inside my rbac rules. Because of that, when I run the create action from that resource, it will fail with this error when returning the value: ```...

How can I do a 'like' query or similarity search?

Hi, I am looking to do fuzzy search. So, for example , if the user types in 'dan'. I'd like to return all users whose names or emails include 'dan'. I read through the predicate list here: https://hexdocs.pm/ash/Ash.Filter.html hoping for something like 'like' in SQL, but I didnt see naything. What is the best approach? Here is how my code looks currently:...

Is the structure from the auto-generated graph filters from some spec?

Interesting to observe that by default Ash will generate me a whole tree of options to filter and sort a list inside a graph query. I'm still kind of new to graph. Is this design/structure specific to any single frontend library like Rely or Apollo?...
No description

Nested aggregates and calculations

I have a calculation that looks like this conceptually: ``` some_documentation_created (calculation) refers to: count_of_documented_skills (aggregate) filters by:...

use embedded fields inside expr

I have a resource that contains as one of its attributes another resource that is an embedded one. ```elixir defmodule Pacman.Markets.Property.Contact do @moduledoc false...

Ash JSON API is showing an error when following tutorial

Hello, after taking a break from Phoenix and Ash, I decided to move forward with my side project. When setting up the ash_json_api extension, I got the following error: ``` Compiling 18 files (.ex) error: function plug/2 imported from both Phoenix.Router and Plug.Builder, call is ambiguous...

Trying to better understand filter in the context of AshGraph

I am trying to work through some basics of AshGraph, and in the guide it has you set up a filter with code like: ``` read :query_tickets do argument :representative_id, :uuid...

JSON-API And Calculations

Hi, I have a couple of calculations on my models and they seamlessly work in GraphQL. Now I need to make them accessible from the JSON-API and find no automatic way to address them. Do I need to write an extra-route or how should I approach this?

Applying constraints to embedded union types

I have a resource when an embedded array of union types: ```elixir defmodule MyApi.Package attributes do...

How to: Keyset pagination in AshJsonApi

When I enable keyset pagination in my read action, I get an error
** (KeyError) key :metadata not found in: #SomeAshResource..
** (KeyError) key :metadata not found in: #SomeAshResource..
...

DISTINCT ON LEAST() GREATEST()

SELECT DISTINCT ON (LEAST(author_id, recipient_id), GREATEST(author_id, recipient_id)) id, text, author_id, recipient_id...

Ash.Query.filter creates filter with OR condition instead of AND

Ash.Query.filter function documentation explicitly says that a filter will be added with the AND condition, but it seems that this is not the case when fragments is used. For example, if I do this: ```elixir...

Generated filter expression is incorrect - BUG

Hello, I think I found a bug in Ash's query builder. I have the following filter expression in my resource action: ```elixir...

Filter by struct keys in a read action

So I have an ash actions. It receives a struct as an input. I want to create a filter that filters by values inside the struct. here's a simplified version of the action:...