I want to dive into graphQL using Java. I want to query an existing graphQL Service. From what I have found so far are ways to generate the graphQL schemafiles either in JSON or IDL from your POJO classes, but not the other way round....? From what I have understood so far, I would have to create the java classes myself that "represent" the objects I would receive from a query. But the service I want to use has tons of endpoints and queries and the need of writing each pojo class myself sounds like I have missed something... I assume there must be a way to generate stubs like I am used to from REST API frameworks using swagger or yaml files? So... how can I generate the pojo classes automagically given only the schemafile? I have read the description of the schema-first approach at graphql-java but they also assume to write the pojo-classes by oneself.
thank you
You can use a plugin for your build tool to generate POJOs for GraphQL types/inputs/interfaces/enums/etc and interfaces for queries/mutations/subscriptions. All based on your GraphQL schema.
Link to the project: https://github.com/kobylynskyi/graphql-java-codegen
It has the following plugins for your build tool:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With