Skip to content

Question: How to generate the schema and wiring at runtime? #452

Closed
@nielsbasjes

Description

@nielsbasjes

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.

Metadata

Metadata

Assignees

Labels

for: stackoverflowA question that's better suited to stackoverflowstatus: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions