ash-project / ash_json_api

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

use phoenix endpoint if available #95

Closed gordoneliel closed 1 year ago

gordoneliel commented 1 year ago

Whats new

Uses phoenix_endpoint for link url generation if present in the conn.

Fixes https://github.com/ash-project/ash_json_api/issues/94

Contributor checklist

zachdaniel commented 1 year ago

LGTM, let me know if its ready to merge :)

gordoneliel commented 1 year ago

@zachdaniel Added a test. BTW seems a bit hacky referencing phoenix_endpoint here when we don't explicitly depend on phoenix? Also assumes there will be a .url() function in that module. Probably a better way with a callback or config of some sort in the future, thoughts?

zachdaniel commented 1 year ago

It's a bit weird but it's better than something more complex IMO

gordoneliel commented 1 year ago

@zachdaniel In a stalemate here. mix format requires parenthesis on the function call, credo does not want it

zachdaniel commented 1 year ago

Will take care of it, not sure what's up :)