-
Notifications
You must be signed in to change notification settings - Fork 366
Description
Library Version
graphql-kotlin: 5.0.0-alpha.3
gradle: 6.8.0
Context information
I'm using dgraph as a database and want to connect to it's /graphql
endpoint using the graphql-kotlin client. For this I would like to use the graphqlIntrospectSchema
and graphqlGenerateClient
gradle tasks.
Describe the bug
Changes to a query file (ie. HelloWorldQuery.graphql, see below) and running gradle task graphqlGenerateClient
the changes to the query file will not be present in the generated class HelloWorldQuery
.
Preparation Stepts
- Start dgraph with
docker run --rm -it -p "8080:8080" -p "9080:9080" -p "8000:8000" -v ~/dgraph:/dgraph "dgraph/standalone:v20.11.3"
- Save following graphql schema as
schema.graphql
type Person {
name: String! @search(by: [term])
age: Int!
}
- Add schema to dgraph (save following file as schema.graphql and execute
curl -X POST localhost:8080/admin/schema --data-binary '@schema.graphql'
- Create new Gradle kotlin project with the
com.expediagroup.graphql
plugin - Add the following graphql plugin configuration:
graphql {
client {
endpoint = "http://localhost:8080/graphql"
packageName = "com.example.generated"
queryFileDirectory = "${project.projectDir}/src/main/resources/queries"
}
}
To Reproduce
- Create sample query in
resources/queries
named "HelloWorldQuery.graphql" with content:
query HelloWorldQuery {
queryPerson {
name
}
}
If you are wondering: queryPerson was created by dgraph and will return all Person
objects from the database.
- Execute gradle task
graphqlIntrospectSchema
- Execute gradle task
graphqlGenerateClient
- Now change "HelloWorldQuery.graphql" and add
age
field:
query HelloWorldQuery {
queryPerson {
name
age
}
}
- Execute gradle task
graphqlGenerateClient
for the second time
Expected Results
The generated class HelloWorldQuery
should be updated to represent the change of the query file (age field added). But the file does not seem to be changed after calling gradle task graphqlGenerateClient
for the second time.
The current workaround is to run the gradle task clean
followed by graphqlGenerateClient
. After that, the class will be recreated with the age
field.