| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ontexts ShallowTypeRefCollector called scanArgumentType(arg) for GraphQLArgument objects in several places but never scanAppliedDirectives(arg.getAppliedDirectives()), and never descended into enum values to scan their applied directives. This left GraphQLTypeReference objects in applied directive argument types unresolved, causing the AppliedDirectiveArgumentsAreValid validator to spuriously fail with "Invalid argument 'x' for applied directive of name 'y'". Three locations fixed: 1. handleObjectType / handleInterfaceType — field argument applied directives were not scanned. Added scanAppliedDirectives(arg.getAppliedDirectives()) inside the field-argument loop of both methods. 2. handleTypeDef — already scanned applied directives on the enum type itself (via the GraphQLDirectiveContainer branch), but never descended into enum values. Added handleEnumType() which scans applied directives on each GraphQLEnumValueDefinition. 3. handleDirective — directive definition argument applied directives were not scanned. Added scanAppliedDirectives(argument.getAppliedDirectives()) inside the argument loop. SchemaUtil.replaceTypeReferences (used by the standard Builder) does a full deep traversal via getChildrenWithTypeReferences() and handles all of these correctly; this change brings ShallowTypeRefCollector in line with that behavior. Adds four regression tests in FastBuilderTest covering: - Applied directive on object type field argument - Applied directive on interface field argument - Applied directive on enum value - Applied directive on directive definition argument Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
(more internal testing has failed -- stand by...) |
Sorry, something went wrong.
|
@rstata is that ready or are we waiting for more? |
Sorry, something went wrong.
Test ReportTest Results
Code Coverage (Java 25)
Changed Class Coverage (1 class)
|
Sorry, something went wrong.
|
oops -- i forgot about this! turns out this version did fix all the problems, viaduct builds and passes all its tests with this fix in place. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
ShallowTypeRefCollector (introduced with FastBuilder in #4196) performs
shallow scans of types and directives to collect GraphQLTypeReference objects
for later replacement. In three places it called scanArgumentType(arg) on a
GraphQLArgument but never called scanAppliedDirectives(arg.getAppliedDirectives()).
It also had no handling to descend into GraphQLEnumValueDefinition objects to
scan their applied directives.
The result: when FastBuilder is used with programmatically-constructed types
carrying GraphQLTypeReference objects in applied directive argument types on
field arguments, enum values, or directive definition arguments, those references
are never resolved. The AppliedDirectiveArgumentsAreValid validator then sees a
GraphQLTypeReference where it expects a real input type and throws:
(This does not manifest when types are built via FastSchemaGenerator + SDL,
because SchemaGeneratorHelper.buildInputType resolves types at construction
time. It manifests when FastBuilder is used directly with programmatically-built
types.)
Changes
Three locations in ShallowTypeRefCollector fixed:
handleObjectType / handleInterfaceType — added
scanAppliedDirectives(arg.getAppliedDirectives()) inside the field-argument
loop of both methods, alongside the existing scanArgumentType(arg) call.
handleTypeDef — added handleEnumType() which iterates over
GraphQLEnumValueDefinition values and scans their applied directives. (Applied
directives on the enum type itself were already covered by the existing
GraphQLDirectiveContainer branch.)
handleDirective — added scanAppliedDirectives(argument.getAppliedDirectives())
inside the directive-argument loop alongside the existing scanArgumentType call.
Adds four regression tests in FastBuilderTest covering all three fix locations:
applied directive on object type field argument, interface field argument, enum
value, and directive definition argument.
Related
Bug in the FastBuilder / ShallowTypeRefCollector introduced in #4196.