Question: How to generate the schema and wiring at runtime?
Hi,
For a project where the schema is to be determined at the start of the application (it can change depending on configuration) I'm looking at generating the schema and all related things at startup.
I have put my efforts (as clean as possible) in this test project.
https://github.com/nielsbasjes/spring-gql-test/blob/main/src/main/java/nl/basjes/experiments/springgqltest/MyDynamicGraphQLApi.java
Works partially.
The schema that is generated is what I have in mind for this test.
Yet when running this query:
query {
DoSomething(thing: "foo") {
commit
url
}
}
I expect this
{
"data": {
"DoSomething": {
"commit": "Something",
"url": "Something"
}
}
}
but I get this:
{
"data": {
"DoSomething": null
}
}
So as far as I can tell I'm doing something wrong with regards of the runtime wiring.
As I have trouble finding a working demo application that does this I'm asking here.
What am I doing wrong? What have I overlooked? Where can I find the documentation I misunderstood?
Thanks.