Closed
Description
Describe the bug
SchemaUsageReport is not visiting GraphQLAppliedDirectives, this can sometimes result in SchemaUsage giving incorrect information about whether a directive is being referenced.
To Reproduce
- create a schema that contains a directive definition and a field that uses that directive
- manipulate the schema, clearing the list of directives from the field, and adding the applied directive back to it.
For example:
List<GraphQLAppliedDirectives> directives = fieldDef.getAppliedDirectives();
fieldDef.transform(f -> f.clearDirectives().replaceAppliedDirectives(directives))
- at this point the field should have an empty list of GraphQLDirective, and a list of GraphQLAppliedDirective containing 1 item
- run the schema through SchemaUsage and check if the directive is being referenced:
schemaUsage.isStronglyReferenced(schema, "directiveName")
expected behaviour: isStronglyReferenced
should return true
, since the directive is applied to the field
actual behaviour: isStronglyReferenced
returns false