graphql-java-tools: Exception in thread "main" graphql.AssertException: Internal error: should never happen: Directive values of type 'EnumValue' are not supported yet
This is an exception that is thrown by graphql-java when called from graphql-java-tools. The problem, however, is due to the way graphql-java-tools is using the graphql-java library internal API.
This is evidenced in this issue in graphql-java for a PR created to attempt to fix this issue: https://github.com/graphql-java/graphql-java/pull/1706
Tools does not pass a directiveDefinition – which is never mapped at any point in the SchemaParser https://github.com/graphql-java-kickstart/graphql-java-tools/blob/master/src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt#L163 And this causes graphql-java to use a code path that, according to them, is dead code and actually is removed in v15.
I created a test application to demonstrate this issue here: https://github.com/dspenceb/graphqltest
For quick reference, the schema:
type Query {
books: [Book!]
}
type Book {
id: Int!
name: String! @allowed(
allowed: [ALLOWED]
)
author: Author!
}
...
directive @allowed(
allowed: [AllowedState!]
) on FIELD_DEFINITION | OBJECT
enum AllowedState {
ALLOWED
DISALLOWED
}
wiring:
GraphQLSchema schema = SchemaParser.newParser()
.file("schema.graphqls")
.resolvers(new QueryResolver(new BookRepository()), new BookResolver(new AuthorRepository()))
.directive("allowed", new AllowedDirective())
.build()
.makeExecutableSchema();
Stack:
Exception in thread "main" graphql.AssertException: Internal error: should never happen: Directive values of type 'EnumValue' are not supported yet
at graphql.Assert.assertShouldNeverHappen(Assert.java:51)
at graphql.schema.idl.SchemaGeneratorHelper.buildDirectiveInputType(SchemaGeneratorHelper.java:203)
at graphql.schema.idl.SchemaGeneratorHelper.buildDirectiveInputType(SchemaGeneratorHelper.java:201)
at graphql.schema.idl.SchemaGeneratorHelper.buildDirectiveArgument(SchemaGeneratorHelper.java:272)
at graphql.schema.idl.SchemaGeneratorHelper.lambda$buildDirective$6(SchemaGeneratorHelper.java:251)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at graphql.schema.idl.SchemaGeneratorHelper.buildDirective(SchemaGeneratorHelper.java:252)
at graphql.kickstart.tools.SchemaParser.buildDirectives(SchemaParser.kt:150)
at graphql.kickstart.tools.SchemaParser.createField(SchemaParser.kt:278)
at graphql.kickstart.tools.SchemaParser.access$createField(SchemaParser.kt:18)
at graphql.kickstart.tools.SchemaParser$createObject$$inlined$forEach$lambda$1.apply(SchemaParser.kt:124)
at graphql.kickstart.tools.SchemaParser$createObject$$inlined$forEach$lambda$1.apply(SchemaParser.kt:18)
at graphql.schema.GraphQLObjectType$Builder.field(GraphQLObjectType.java:308)
at graphql.kickstart.tools.SchemaParser.createObject(SchemaParser.kt:123)
at graphql.kickstart.tools.SchemaParser.parseSchemaObjects(SchemaParser.kt:68)
at graphql.kickstart.tools.SchemaParser.makeExecutableSchema(SchemaParser.kt:98)
at dspenceb.graphqltest.Main.main(Main.java:17)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 27 (2 by maintainers)
Commits related to this issue
- PoC of using latest code with graphql-java v20 and Java 8 Unfortunately, we still have a need for this. #411 — committed to crankydillo/graphql-java-tools by crankydillo 6 months ago
FYI: I tried with the latest 11.0.0 and still having this issue now
hi @vojtapol thanks for the response! Is there any kind of timeline or ETA on when that may be?
Thanks!
Thanks for reporting this. This will be likely fixed in the next version when we support GraphQL Java 15.
@crankydillo Alright I hope this works for you: https://github.com/graphql-java-kickstart/graphql-java-tools/releases/tag/v13.0.4
@crankydillo right so there’s a bug in the deploy script that I don’t have the time to look into. However, since the artifact was pushed I guess I could create a release for it and it should technically be fine. Let me know if that’s what you want.
@crankydillo Okay I see what you mean. If you want to open a PR for this I can try releasing a “hotfix”
Anybody has a workaround for this?
@vojtapol Any plans to supports this in the near future?