Description
I'm seeing unexpected behavior from SchemaParser that prevents me to properly upgrade to the newest versions of graphql-java 19.2 & graphql-java-kickstart 15.
I'm using GraphQL Federation via com.apollographql.federation:federation-graphql-java-support:2.2.0 which includes directives such as @extends or @key in the schema. Starting with graphql-java-tools 13.0.2, these are not only reported as appliedDirectives, but as directives as well. This causes the validation to fail and the server to not start, because they are not defined in the same schema:
# ... stack trace ...
Caused by: graphql.schema.validation.InvalidSchemaException: invalid schema:
A definition for directive 'extends' could not be found
A definition for directive 'key' could not be found
A definition for directive 'external' could not be found
# ...
I believe this is incorrect with regards to the docs in https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/GraphQLDirective.java#L28-L32. From my limited knowledge, I think this states that the field directives should only contain directive definitions and no longer directive applications, however I'm not entirely sure whether I'm reporting this at the right place.
It works correctly with either
- graphql-java-kickstart 14 that depends on
com.graphql-java-kickstart:graphql-java-tools 13.0.0
- graphql-java-kickstart 15 and downgrading
com.graphql-java-kickstart:graphql-java-tools to 13.0.1
Expected behavior
Parsing such a schema:
type Query @extends {
dummy(): String
}
with schemaParser.parseSchemaObjects() should return empty query.directivesHolder.allDirectivesByName == [] and query.directivesHolder.allAppliedDirectivesByName == ["extends" to ...]
Actual behavior
Parsing with schemaParser.parseSchemaObjects() returns query.directivesHolder.allDirectivesByName == ["extends" to ...].
Steps to reproduce the bug
See SDL example above. In case this is insufficient, I can also provide a minimal repro project.
Description
I'm seeing unexpected behavior from
SchemaParserthat prevents me to properly upgrade to the newest versions of graphql-java 19.2 & graphql-java-kickstart 15.I'm using GraphQL Federation via
com.apollographql.federation:federation-graphql-java-support:2.2.0which includes directives such as@extendsor@keyin the schema. Starting with graphql-java-tools 13.0.2, these are not only reported asappliedDirectives, but asdirectivesas well. This causes the validation to fail and the server to not start, because they are not defined in the same schema:I believe this is incorrect with regards to the docs in https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/GraphQLDirective.java#L28-L32. From my limited knowledge, I think this states that the field
directivesshould only contain directive definitions and no longer directive applications, however I'm not entirely sure whether I'm reporting this at the right place.It works correctly with either
com.graphql-java-kickstart:graphql-java-tools13.0.0com.graphql-java-kickstart:graphql-java-toolsto 13.0.1Expected behavior
Parsing such a schema:
with
schemaParser.parseSchemaObjects()should return emptyquery.directivesHolder.allDirectivesByName == []andquery.directivesHolder.allAppliedDirectivesByName == ["extends" to ...]Actual behavior
Parsing with
schemaParser.parseSchemaObjects()returnsquery.directivesHolder.allDirectivesByName == ["extends" to ...].Steps to reproduce the bug
See SDL example above. In case this is insufficient, I can also provide a minimal repro project.