Can't disable derive_filter? in json API

I have this json API definition in my domain
json_api do
routes do
base_route "/runtime-config", MyApp.RuntimeConfig do
# Unlike normal get actions, we only have one config. We don't want the `get` route to require "/:id".
get :get, route: "", derive_filter?: false
end
end
end
json_api do
routes do
base_route "/runtime-config", MyApp.RuntimeConfig do
# Unlike normal get actions, we only have one config. We don't want the `get` route to require "/:id".
get :get, route: "", derive_filter?: false
end
end
end
And on the resource I have this
json_api do
type "runtime-config"
end
json_api do
type "runtime-config"
end
Yet when I go to my open api page I still see input field for the filter.
10 Replies
Sienhopist
SienhopistOP•4mo ago
I found this issue, but I don't know how to solve it https://github.com/ash-project/ash_json_api/issues/193
GitHub
derive_filter? false does not appear to do anything at the resour...
The docs say this should be supported at the resource level, but after adding it to my json_api block: json_api do type "artist" includes [:albums] derive_filter? false end I still have f...
sevenseacat
sevenseacat•4mo ago
that's for config at the resource level, not on the individual route
Sienhopist
SienhopistOP•4mo ago
I forgot to mention I've also tried putting derive_filter? false on the resource, just below the type line in my above example, but it doesn't change anything
sevenseacat
sevenseacat•4mo ago
🤔 what version of ash_json_api are you using?
Sienhopist
SienhopistOP•4mo ago
1.4.36 FYI I think the same issue happens with derive_sort? regardless where I put it Ignore that I was thinking of something else. I was thinking of the includes parameter in open API Not sure if it's related, but this get route I've defined goes to a custom action instead of a read action. I switched from get to route which implicitly removed the parameters for filtering and including relationships. However, they're both still present on the patch route which goes to the normal default update action... In this version of ash_json_api, the function that creates this parameter is in deps/ash_json_api/lib/ash_json_api/json_schema/open_api.ex line 1631. I may be misunderstanding something, but I don't see anything checking the derive_filter? option around this function.
ZachDaniel
ZachDaniel•4mo ago
🤔 there is a filter option on patch routes?
Sienhopist
SienhopistOP•4mo ago
Maybe this was never meant to be configurable and I was just confusing the parameter Limits the response fields to only those listed for each type with the option for filtering?
ZachDaniel
ZachDaniel•4mo ago
🤔 I think there are a few different things that are being talked about here and I've kind of lost the thread
Sienhopist
SienhopistOP•4mo ago
Yeah I was talking about the automatically generated parameter for limiting which fields of your resource are returned. And I was confusing it with the configurable parameter for filtering based on values. Basically the former generates the SELECT statement and the latter generates the WHERE statement. I think it's not possible to disable the SELECT one So, sorry for the confusion 😅
ZachDaniel
ZachDaniel•4mo ago
Correct, you can't disable fields its part of the spec but we could make it a thing

Did you find this page helpful?