improvement: validate cross-field dependencies in graphql DSL options at compile time#416
Merged
zachdaniel merged 2 commits intoash-project:mainfrom Mar 7, 2026
Conversation
20fafdb to
25aaa62
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a new Spark DSL verifier to validate cross-field dependencies among graphql DSL options for AshGraphql resources, raising on contradictions and emitting compile-time warnings for configurations that would have no runtime effect.
Changes:
- Introduces
AshGraphql.Resource.Verifiers.VerifyFieldDependenciesto detectshow_fields/hide_fieldscontradictions and warn on references to non-visible or excluded relationship fields. - Registers the new verifier in the AshGraphql resource extension verifier pipeline.
- Adds a comprehensive ExUnit test suite covering contradiction errors and the expected warning scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/resource/verifiers/verify_field_dependencies.ex |
New verifier implementing compile-time cross-option dependency checks (errors + warnings). |
lib/resource/resource.ex |
Registers the new verifier in the extension’s @verifiers list. |
test/verify_field_dependencies_test.exs |
Adds unit tests validating contradictions and warning behavior across supported options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
🚀 Thank you for your contribution! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributor checklist
Leave anything that you believe does not apply unchecked.
Summary
show_fieldsandhide_fieldsoverlap (contradiction)sortable_fields,filterable_fields,nullable_fields,field_names,relationships,paginate_relationship_with,attribute_input_typesreference fields that are not visible (hidden or not in show_fields)paginate_relationship_with,filterable_fields,field_names,nullable_fieldsreference relationships excluded from therelationshipsoption