ash-project / ash-project/ash_json_api

Allow `destroy` routes to point at `update` actions.

Open
#251 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
94
Forks
80
Avg merge
5h 5m
Merged PRs (30d)
4

Description

**Is your feature request related to a problem? Please describe.**
My resource has the following update action:

```elixir
update :close do
change set_attribute(:status, "closed")
end
```

When exposing it via JSON:API I think the most reasonable thing to do is expose it as a `DELETE` endpoint.

**Describe the solution you'd like**
Allow `delete` route entities to accept update actions in addition to destroy and generic actions.

**Describe alternatives you've considered**

```elixir
routes do
base "/tickets"
patch :close, route: "/:id/close"
end
```

**Express the feature either with a change to resource syntax, or with a change to the resource interface**

```elixir
routes do
base "/tickets"
delete :close
end
```

**Additional context**
🐚

Contributor guide

Open the contributing guide

Research direction

Locate the JSON:API route handling for delete entities and the validation that limits them to destroy or generic actions. Confirm that a `delete :close` declaration accepts the update action and verify the route invokes it with the expected DELETE behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.