Ash FrameworkAF
Ash Framework8mo ago
9 replies
Ahrou

AshJsonAPI generic action arguments in a GET route

I have this simple generic action and route
base_route "/operational-settings", Core.OperationalSetting do
  route(:get, "/:configuration_key", :get)
end

 action :get, :struct do
  constraints instance_of: Type.OperationalSettingValue

  argument :configuration_key, :string, allow_nil?: false
  argument :campaign_id, :string, allow_nil?: true

  run fn input, context ->
    get_setting(input.arguments, context.actor)
  end
end


As it is defined we can see the argument in the request body in the open_api spec, but it does not get picked up in a GET request.

Changing the route to a POST works, so i am wondering if in a GET request arguments are not supported? I also tried setting the query param campaign_id but still nothing.
Solution
there is a query_params option IIRC that determines which action inputs are lifted to query params though
Was this page helpful?