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

fix: bug when multiple domains are used in a router #134

Closed jsw800 closed 4 months ago

jsw800 commented 4 months ago

Contributor checklist

I noticed this bug in the new router when I added a second domain to my router. It was pretty easy to track down the source of the issue so I figured I'd just submit a PR.

Basically the issue arises because :error is truthy, so if this inner Enum.find_value returns error on the first iteration (i.e. when checking for a match in the first domain), then the whole loop will return :error, even though there are more domains to check. In this scenario the intended behavior should be to return nil.

zachdaniel commented 4 months ago

🚀 Thank you for your contribution! 🚀

zachdaniel commented 4 months ago

Released in v1.0.0-rc.6