-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query type and QueryProjectionRoot classes are not generated for client code #589
Comments
This is by design. We generally make requests for single queries so far and therefore have not implemented a top-level Query type. Could you describe how would you use the client API in that case? |
Thank you @srinivasankavitha for your reply. Well I'd simply do something like
The root |
Thanks for the description. We didn't design for this scenario since this is not something we actively use internally at Netflix. That said, it would involve a breaking change to the existing API to support this, so this is not something we would prioritize at the moment either (also since we don't really need this feature). |
Thank you for your reply. I understand that you don't need that feature, but it's a pretty fundamental feature for any GraphQL schema, too bad for us :-(
TBH I don't really understand why it would be a breaking change. Everything else would continue to work exactly as before, it would simply be an extra feature to make queries. You might need to handle the root types in a special manner because of the way you serialize the queries to string, but IMO you don't have to make any breaking change. |
I think we may be able to get away without making a breaking change, but it will need some more investigation. The example you pointed out is a simple use case. It does get complicated to specify the projection fields on each query field, especially when the query depth is more. But we may be able to handle that differently. In any case, we'll keep the issue open so we can prioritize it in future. I do agree it is a nice feature to have in any case, just not something we can prioritize at the moment. |
To add another perspective, at our client we have established the pattern that mutation return types have a field of type A minimal schema could look like this type Query {
mutatedValue: String
}
type Mutation {
performUpdate: PerformUpdateResponse
}
type PerformUpdateResponse {
query: Query
} Allowing for queries such as mutation PerformUpdate {
performUpdate {
query {
mutatedValue
}
}
} At the moment, we cannot directly generate classes for this schema because the class generated for |
Hello. I'm evaluating
dgs-codegen
and when generating client code, it seems it doesn't generate any type nor projection classes for the rootQuery
type. If I want to write a client request using multiple top-level fields under the root type, I'd expect to have classes generated for the rootQuery
type, likeQuery
,QueryProjectionRoot
, andQueryGraphQLQuery
.Is this intentional? For example with a simple schema as
I'd expect to also get all the
Query
classes to be able to query the two fields at the same time. I can write them by hand, but it's not really nice because I'd have to change them each time a new top-level field is added underQuery
.The text was updated successfully, but these errors were encountered: