JSON-API Related() Seems Broken
Hi,
there seems to be a regression in the JSON-API: It worked nicely (after you did a fix a couple of weeks ago), but after updating packages to the newest ones, I get an exception.
Here’s the relation:
This is the exception I get:
Here’s the relation:
related(:events, :events_by_extid) do
route("/:extid/events")
endrelated(:events, :events_by_extid) do
route("/:extid/events")
endThis is the exception I get:
[error] #PID<0.3383.0> running TickerWeb.Endpoint (connection #PID<0.3382.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /api/eventhub/alarms/R%201.5%20230310%201956/events
** (exit) an exception was raised:
** (UndefinedFunctionError) function :events.name/0 is undefined (module :events is not available)
:events.name()
(ash_json_api 0.32.0) lib/ash_json_api/controllers/helpers.ex:348: anonymous fn/1 in AshJsonApi.Controllers.Helpers.fetch_related/2
(ash_json_api 0.32.0) lib/ash_json_api/controllers/get_related.ex:20: AshJsonApi.Controllers.GetRelated.call/2
(ticker 0.1.0) deps/plug/lib/plug/router.ex:246: anonymous fn/4 in TickerWeb.Api.Router.dispatch/2
[...]
(cowboy 2.10.0) deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.10.0) deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
(cowboy 2.10.0) deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
(stdlib 4.3.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3[error] #PID<0.3383.0> running TickerWeb.Endpoint (connection #PID<0.3382.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /api/eventhub/alarms/R%201.5%20230310%201956/events
** (exit) an exception was raised:
** (UndefinedFunctionError) function :events.name/0 is undefined (module :events is not available)
:events.name()
(ash_json_api 0.32.0) lib/ash_json_api/controllers/helpers.ex:348: anonymous fn/1 in AshJsonApi.Controllers.Helpers.fetch_related/2
(ash_json_api 0.32.0) lib/ash_json_api/controllers/get_related.ex:20: AshJsonApi.Controllers.GetRelated.call/2
(ticker 0.1.0) deps/plug/lib/plug/router.ex:246: anonymous fn/4 in TickerWeb.Api.Router.dispatch/2
[...]
(cowboy 2.10.0) deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.10.0) deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
(cowboy 2.10.0) deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
(stdlib 4.3.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3