srikanthkyatham
Hi
I hope I am rephrase my usecase. I have trimmed down for clarity sake. Let’s say that, I have a
defmodule ResourceA do
...
attributes do
attribute :date
end
end
ResourceB
defmodule ResourceB do
...
attributes do
attribute :methods, one_of: [:phone, :online]
end
end
ResourceC - whose job is get values from ResourceA and ResourceB and return it.
defmodule ResourceC do
...
code_interface do
define :overlap, args:[...]
end
actions do
action :overlaps, .. do
argument :start_date, :string, allow_nil?: false
argument :method, :atom, allow_nil?: false
run fn input, context ->
start_date = inputs.arguments.start_date
method = inputs.arguments.method
# gets overlaps from ResourceA and ResourceB
{:ok, result}
end
end
end
end
Now in the Doamin
defmodule Domain do
use Ash.Domain, extensions:[AshJsonApi.Domain]
resources do
...
end
json_api do
routes do
base_route "/overlaps", ResourceC do
route :get, "/overlaps", :overlaps
end
end
end
end
I am able to make the call. I can’t pass query params to the api call. I tried to debug but in vain. I am getting 400 error response. Any help is appreciated.
Thanks.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
I’m posting this in response to Jose’s recent tweet (Cr. link) :
People are sleeping on Elixir for a coding harness:
Hot-code swappi...
New
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes.
We’re a small ...
New
This might be a bit disturbing for some but it’s happening - computers running on living human neurons. They’ve made them smart enough t...
New
Other Trending Topics
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
In the code that I can see here, the action does not have
start_dateormethodarguments. Have you added those arguments to the generic action?zachdaniel
Also, when sharing errors etc. please share as much context, like what the response body was for the 400 error and if there are any logs indicating additional detail etc. Just 400 status could be many many things
srikanthkyatham
Hi
My bad. Yes the start_date and method are arguments for the action.
here is the response.
I have noticed that if I don’t pass the arguments as query parameters. I get the error saying that I am missing the arguments. If I pass the arguments they are not ending up in the Ash.run_action() call being made from the GenericActionRoute. I am not sure what I was missing.
zachdaniel
Hmm…it sounds like a bug? So
input.argumentsis an empty map?srikanthkyatham
Yes it is empty. I have noticed query_params is being populated in AshJsonApi.Request.parse_query_params, but it is relying on request.route. Not from request.query_params. I did not understand why it was done like that. I didnot dig deeper after that.
zachdaniel
Oh, right, did you set this? AshJsonApi.Resource — ash_json_api v1.7.0
i.e
… I think it is for post and other methods that could include a body and so require being told what is where. In the future we could probably assume that for get requests all of the inputs are query params.
query_params: [:start_date, :method]. I’m trying to remember why we require that to be setsrikanthkyatham
Oh I missed that. I got it working. Thanks stupid me. I should have gone through the options first