Closed ulbrich closed 8 months ago
Thanks for the report! I've pushed something to main
that removes that check. I see no use for it at this point. Please try it out and let me know if it works, will cut a release once I get a chance.
Looks very good, but I'm running into a followup-errorβ¦ π
[error] #PID<0.6986.0> running TickerWeb.Endpoint (connection #PID<0.6971.0>, stream id 2) terminated
Server: localhost:4000 (http)
Request: GET /api/eventhub/open_api
** (exit) an exception was raised:
** (KeyError) key :description not found in: nil
If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
(ash_json_api 0.34.2) lib/ash_json_api/json_schema/open_api.ex:537: AshJsonApi.OpenApi.action_description/2
(ash_json_api 0.34.2) lib/ash_json_api/json_schema/open_api.ex:523: AshJsonApi.OpenApi.operation/3
(ash_json_api 0.34.2) lib/ash_json_api/json_schema/open_api.ex:505: AshJsonApi.OpenApi.route_operation/3
(elixir 1.15.3) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.15.3) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.15.3) lib/enum.ex:4317: Enum.flat_map_list/2
(elixir 1.15.3) lib/enum.ex:4318: Enum.flat_map_list/2
(ash_json_api 0.34.2) lib/ash_json_api/json_schema/open_api.ex:489: AshJsonApi.OpenApi.paths/1
(elixir 1.15.3) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
(ash_json_api 0.34.2) lib/ash_json_api/json_schema/open_api.ex:482: AshJsonApi.OpenApi.paths/1
(ash_json_api 0.34.2) lib/ash_json_api/controllers/open_api.ex:54: AshJsonApi.Controllers.OpenApi.spec/2
(ash_json_api 0.34.2) lib/ash_json_api/controllers/open_api.ex:14: AshJsonApi.Controllers.OpenApi.call/2
The implication there is that you have a route set up to use an action that doesn't exist. I've added a better error in main
. But something like index :foo, ...
, :foo
has to be an action.
Yes, that sounds more like it, but it's not that the action is missing: It's a manual one:
relationships do
has_many :photos, Ticker.Eventhub.ArticlePhoto do
manual Ticker.Eventhub.Article.ResolveAddressPhotos
end
end
[...]
related(:photos, :read) do
route("/:id/photos")
end
That read
doesn't exist, but how can I fix that?
π€ can you put the :read
action on the destination resource even if you don't use it?
There already is one. The ArticlePhoto
model is a Ash.DataLayer.Simple
and that's why I'm using a manual lookup from the Article, but it also has its own route. Maybe that's the problem?
π€ okay, I think I see the issue.
For related routes, we need to look at the related resource and its currently not doing that :)
Just pushed something to main :)
Wow, that's it: You're the best! π
Thank you, and thank you for your support π
Hi there! π I get the following exception when accessing the Open-API specs:
I can get rid of the exception, if I remove the following two relations:
For the first I experimented with changing
unless path_params == [] or path_params == ["id"] do
tounless is_list(path_params) and Enum.count(path_params) < 2 do
as the name of the parameter should be irrelevant (and that helps), but I still run into the second error.Versions
This is what I have in ASDF
.tool-versions
:Dependencies