You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like @GraphQLIgnore is not respected by the schema generator when running as GraalVM native image.
Note: This problem is only true for @GraphQLIgnore on function level.
When using @GraphQLIgnore on a function parameter, it works as expected and without problems (ie. fun onlySecondParameterShouldNotBePartOfSchema(first: Int, @GraphQLIgnore second: Int) : Int = first + second).
When using @GraphQLIgnore on attributes (var/val) it works as expected, too.
To Reproduce
Create new GraphQL kotlin based project (here using ktor)
When this is executed with a JRE the following schema is generated:
type Query {
shouldBePartOfSchema: Boolean!
}
When executed as GraalVM native image (ie. ./gradlew nativeRun), the following incorrect schema is generated:
type Query {
shouldBePartOfSchema: Boolean!
shouldNotBePartOfSchema: Int!
}
By the way:
If the function with @GraphQLIgnore annoation contains unsupported GraphQL types, the application will not even start as the schema generator will throw InvalidInputFieldTypeException or TypeNotSupportedException depending on whether it was an input parameter or return type.
Expected behavior
I would expect the schema to be identical - no matter which runtime (JRE or native image) is being used. shouldNotBePartOfSchema shall not be part of the schema as it is annotated with @GraphQLIgnore.
It seems like GraalVM native image is using a different kind of schema generation method or at least comes with some limitations. It will not respect the @GraphQLIgnore annotations.
Please either fix the schema generation for GraalVM native image based executables or describe the limitations (ie. @GraphQLIgnore is not working with GraalVM native image).
Example Project
The following project contains an example for this bug.
Library Version
Describe the bug
It seems like
@GraphQLIgnore
is not respected by the schema generator when running as GraalVM native image.Note: This problem is only true for
@GraphQLIgnore
on function level.@GraphQLIgnore
on a function parameter, it works as expected and without problems (ie.fun onlySecondParameterShouldNotBePartOfSchema(first: Int, @GraphQLIgnore second: Int) : Int = first + second
).@GraphQLIgnore
on attributes (var/val) it works as expected, too.To Reproduce
@GraphQLIgnore
annotationGraphQLIgnore no respected in general
When this is executed with a JRE the following schema is generated:
When executed as GraalVM native image (ie.
./gradlew nativeRun
), the following incorrect schema is generated:By the way:
If the function with
@GraphQLIgnore
annoation contains unsupported GraphQL types, the application will not even start as the schema generator will throwInvalidInputFieldTypeException
orTypeNotSupportedException
depending on whether it was an input parameter or return type.Expected behavior
I would expect the schema to be identical - no matter which runtime (JRE or native image) is being used.
shouldNotBePartOfSchema
shall not be part of the schema as it is annotated with@GraphQLIgnore
.It seems like GraalVM native image is using a different kind of schema generation method or at least comes with some limitations. It will not respect the
@GraphQLIgnore
annotations.Please either fix the schema generation for GraalVM native image based executables or describe the limitations (ie.
@GraphQLIgnore
is not working with GraalVM native image).Example Project
The following project contains an example for this bug.
native-graphqlignore-bug.zip
./gradlew nativeRun
for the problem./gradlew runFatJar
for the validation with the JVMThe text was updated successfully, but these errors were encountered: