Comments (7)
Query, Mutation and Suscription aren't Netflix DGS requirements, it's a GraphQL requirements.
Not exactly - You can map other types to query, mutation in the schema {} definition block. Perfectly valid as in @jplabadie example. The issue is - client
DGS codegen only supports types named Query
, Mutation
and Subscription
in my experience.
from graphqlcodegen.
Hi @jplabadie. Glad you find the plugin useful!
This is expected behavior. The maven plugin is a thin wrapper over the Netflix codegen library (same library their gradle plugin uses) which does have a requirement on the root type names - they need to be Query, Mutation and Subscription.
Let us know if there are any other questions.
from graphqlcodegen.
from graphqlcodegen.
@jplabadie @zorglube just wanted to follow up here to avoid some confusion.
What you had is a perfectly valid graphql schema. I work with some teams that use something similar using schema to setup query/mutation and mapping query to something like type RootQueryType
that defines all of the queries for that particular schema. DGS can generate types for that and run that schema if you're using Java and the rest of the server side libraries they provide.
The problem is generating the client code - the codegen plugin will not generate client
code and projections as you noticed unless the type is Query
or Mutation
. Even if you've specified in the schema {} block what query and mutation types are.
This schema is powered by DGS Java based server - you can see RootQueryType is defined here, not Query, and executed the shows query.
Here you can see codegen did not generate client code or shows, or any other field on RootQueryType, but did generate code for createShow.
If we rename RootQueryType to Query in this example DGS codegen will generate code for shows and bars.
If there was any confusion I hope this cleared it up.
from graphqlcodegen.
You schema seems bad. AS far as I know it might look like this :
type Something {
query: QueryRoot
}
type QeryRoot [
...
}
type Query {
customers(id: String, emailAlias: String, phoneNumber: String): [Customer]
bookOfTheDead(bookId: String, bookCode: String): BookOfTheDead
}
from graphqlcodegen.
Thank you, and hearing that is the standard really helps. I consider this closed.
from graphqlcodegen.
Yes this is pretty clear. It's simply a convention, not a requirement of GraphQL, but because the schema is pretty sparse syntactically the codegen authors had to make some assumptions about where their plugin could search for Queries, Mutations, and Subscriptions.
Thanks again!
from graphqlcodegen.
Related Issues (20)
- schemaPaths multiple files HOT 1
- Projection classes generate invalid constructors HOT 4
- Is there a way to distinguish explicit null values from missing values? HOT 2
- generateJava code for client when generateClient is true HOT 1
- Maintainer HOT 7
- Add option to skip generation HOT 5
- Plugin delete existing files in <outputDir> HOT 1
- Exclude generated files from code coverage report HOT 6
- Add `maven-release-plugin` HOT 1
- Not able to generate builder classes in Kotlin HOT 2
- Please add a LICENSE file HOT 1
- Fix documentation
- Plugin not generating query client classes
- Include Class Imports and custom annoations HOT 1
- Support for 6.0.1 HOT 1
- Provide a way to pass Java Generic Class as an argument to <typeMapping> HOT 2
- Multiple issues when trying to get a schema from a dependency HOT 2
- integration with codegen and relay pagination HOT 1
- What is the difference between graphql-dgs-codegen-core and graphql-dgs-codegen-client-core? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphqlcodegen.