ash-project / ash_json_api

The JSON:API extension for the Ash Framework
https://hexdocs.pm/ash_json_api
MIT License
55 stars 40 forks source link

Router no longer honors domain list longer than 1. Only first domain is routed. #135

Closed florid-sojourner closed 4 months ago

florid-sojourner commented 4 months ago

Describe the bug Multiple domains listed in the Ash router file only honors the first domain in the list.

To Reproduce

defmodule PhaseManagerWeb.RouterAshJsonApi do
  use AshJsonApi.Router,
    domains: [
        PhaseManager.Templates,
        PhaseManager.Projects
      ],
    json_schema: "/json_schema",
    open_api: "/open_api"
end

Although the Swagger is generated showing the resources of both domains, the second domain resources return:

{
  "errors": [
    {
      "code": "no_route_found",
      "id": "11c64745-d72b-417d-8bf9-d25499a182d8",
      "meta": {

      },
      "status": "404",
      "title": "NoRouteFound",
      "detail": "no route found"
    }
  ],
  "jsonapi": {
    "version": "1.0"
  }
}

Switch the order of the domains, and the other domain resources fail instead.

Expected behavior Both domains' resources should have valid routes that respond to requests

** Runtime

Additional context Add any other context about the problem here.

zachdaniel commented 4 months ago

I believe this was just fixed: https://github.com/ash-project/ash_json_api/pull/134

zachdaniel commented 4 months ago

I will cut a release today or tomorrow. If you'd like you can try that commit and confirm.

florid-sojourner commented 4 months ago

Indeed, that is the same bug and that is the fix. Thanks for your fast reply.

zachdaniel commented 4 months ago

Released in v1.0.0-rc.6