ash-project / ash_graphql

The extension for building GraphQL APIs with Ash
https://hexdocs.pm/ash_graphql
MIT License
71 stars 46 forks source link

chore: add tests on paginated relationships #177

Closed davidebriani closed 3 months ago

davidebriani commented 3 months ago

Following on ash-project/ash#1234, this PR adds tests to verify that relationships can be queried on the results of GraphQL queries and mutations.

Querying paginated relationships on the result of deletions doesn't correctly work yet. Indeed, Ash currently queries relationships using a lateral join but after the resource deletion has happened, so it looks like nothing is related.

Contributor checklist

zachdaniel commented 3 months ago

The "looks like nothing is related" bit is pretty complex. We can try to "simulate" this in ash which is that when relationships are loaded on a query for deletion we could just run the query first, save the relationship data, and then delete without the load. That way we could give a best effort of what the relationships look like. If you think about what its asking its actually kind of ambiguous anyway though, like are you asking for "what it looks like afterwards"? If so, the destroy actions should probably not return anything at all TBH. Anyway, that can be its own conversation :)

zachdaniel commented 3 months ago

@davidebriani are the tests meant to be failing? Is this PR demonstrating a bug?

zachdaniel commented 3 months ago

Or does it just need latest fixes from ash?

davidebriani commented 3 months ago

@zachdaniel the tests should work with the latest version of Ash. I assume you'd want to tag an Ash release first, update deps here, and finally I'll rebase the PR

zachdaniel commented 3 months ago

I guess either way, merging it should be fine. The subprojects test in ash will tell us.

zachdaniel commented 3 months ago

🚀 Thank you for your contribution! 🚀