Repository navigation
chore(grails-data-graphql): root-level cleanup (GraphQLEntityHelper, GraphQLServiceManager, Schema) - #16207
Merged
Conversation
1 task done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.1.x #16207 +/- ##
===================================================
+ Coverage 32.7869% 59.2574% +26.4705%
- Complexity 563 25148 +24585
===================================================
Files 84 2215 +2131
Lines 4941 108864 +103923
Branches 864 19797 +18933
===================================================
+ Hits 1620 64510 +62890
- Misses 3061 35424 +32363
- Partials 260 8930 +8670 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
jdaugherty
force-pushed
the
test/grails-data-graphql-coverage
branch
from
September 23, 2026 21:15
36b7716 to
df7efef
Compare
mapping was declared null then conditionally reassigned across four if/else-if branches before being read - the same shape flagged elsewhere in this cleanup as a false "assignment is not used" warning once IntelliJ's flow analysis loses track of a variable reassigned across many branches. Extracted the reflection lookup (findGraphqlProperty), the graphql-value-to-GraphQLMapping conversion (toGraphQLMapping, with each branch returning directly), and the overall build/verify sequence (buildMapping) into their own methods, so getMapping itself is now a single containsKey-check plus a single build+cache assignment. Added direct unit coverage for getMapping via a Stub(PersistentEntity) (no static graphql property, a Boolean true, an unsupported property type that should throw IllegalMappingException, and cache identity across repeated calls) - previously it was only exercised indirectly through getDescription and other specs' Closure-based mappings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Groovy methods are public by default; the explicit modifier was redundant. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
When no entity contributes any query fields, the method fell off the end without a return statement instead of explicitly returning null. Behavior is unchanged (Groovy allows the implicit null under CompileStatic), but the fall-through was ambiguous to both the reader and the compiler's control-flow analysis. Already covered by DisableAllOpSpec, which asserts generate() returns null when every entity's operations are disabled. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ng branches The Closure branch of toGraphQLMapping allocated a throwaway GraphQLMapping only to call the static build(Closure) through it; call it on the class directly. buildMapping's instanceof check on a variable already typed as GraphQLMapping reduces to a null check. Add direct getMapping coverage for the Closure, LazyGraphQLMapping and prebuilt GraphQLMapping branches, and for verifyMapping's property check, which had no test anywhere: a mapped property that exists on the entity is accepted, and one that does not raises IllegalMappingException naming the property and the entity class.
jdaugherty
force-pushed
the
chore/graphql-root-cleanup
branch
from
September 30, 2026 15:13
cc285e7 to
1c85119
Compare
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.
Summary
Root-package cleanup in
grails-data-graphql, rebased onto8.1.xnow that #16201 is merged:GraphQLEntityHelper#getMapping: consolidated a four-branch reassignment ofmappinginto single-return helper methods (findGraphqlProperty,toGraphQLMapping,buildMapping), fixing a false "assignment is not used" flag. The Closure branch now calls the staticGraphQLMapping.build(Closure)directly instead of through a throwaway instance, and the post-conversion check is a plain null check.GraphQLServiceManager#getService: removed a redundantpublicmodifier (Groovy methods are public by default).Schema#generate(): made the implicitnullreturn explicit when no entity contributes any query fields, satisfying "not all execution paths return a value" with no behavior change (already covered byDisableAllOpSpec).Added direct unit coverage for
getMapping(previously only exercised indirectly viagetDescription): no staticgraphqlproperty,Booleantrue,Closure,LazyGraphQLMapping, prebuiltGraphQLMapping, an unsupported property type, cache identity across repeated calls, andverifyMapping's existing-property check, which had no test anywhere.Test plan
./gradlew :grails-data-graphql-core:test :grails-data-graphql:test :grails-data-graphql-core:codeStyle :grails-data-graphql:codeStylepasses🤖 Generated with Claude Code