Description
When setting up a GET route on a generic action, the resource's id is omitted from the response.
To Reproduce
In this example Resource you can see the issue:
defmodule TestRepo.Domain.Generic do
use Ash.Resource,
domain: TestRepo.Domain,
extensions: [AshJsonApi.Resource]
json_api do
type("generic")
routes do
base "/generic"
route(:get, "", :create)
end
end
actions do
action :create, {:array, :struct }do
constraints items: [instance_of: __MODULE__]
run fn input, context ->
{:ok, [%__MODULE__{
id: 1,
name: "name"
}]}
end
end
end
attributes do
integer_primary_key(:id, writable?: true, public?: true)
# attribute(:id, :integer, primary_key?: true, allow_nil?: false, public?: true)
attribute(:name, :string, public?: true)
end
end
The response JSON is:
[
{
"name": "name"
}
]
Expected behavior
The expected response should be:
Description When setting up a GET route on a generic action, the resource's id is omitted from the response.
To Reproduce In this example Resource you can see the issue:
The response JSON is:
Expected behavior The expected response should be: