-
Notifications
You must be signed in to change notification settings - Fork 122
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
Error generating classes for mutation that returns a union #570
Comments
Hi! Can you share the mutation that leads to that error? |
Sure thing! Here is the mutation. mutation UpdatePrefs($data: UpdatePrefsInput!) {
updatePrefs(data: $data) {
...MyPrefs
... on InputError { message }
... on FieldError {
message
fieldErrors { field, messages }
}
}
}
fragment MyPrefs on MyPrefs { dateFormat, firstDayOfWeek } And here is a full cut down schema needed to reproduce. FYI, this is a simple reproducable adaption from my real schema and mutation (I've deleted most of my code and renamed a number of things for this example). I copied this to a new project with just a schema.graphql and a .graphql file for my mutation, and I get the same error. union UpdatePrefsResponse = MyPrefs | FieldErrors | SimpleMutationError
type Mutation {
updatePrefs(data: UpdatePrefsInput!): UpdatePrefsResponse!
}
input UpdatePrefsInput {
dateFormat: String!
firstDayOfWeek: Int!
}
type MyPrefs {
dateFormat: String!
firstDayOfWeek: Int!
}
interface InputError {
message: String!
}
type FieldErrors implements InputError {
message: String!
fieldErrors: [FieldErrorsField!]!
}
type FieldErrorsField {
field: String!
messages: [String!]!
}
type SimpleMutationError implements InputError {
message: String!
}
|
Thanks! This might be an issue with fragments spreads on a specific case of a union. will take a look |
I have the same problem, too |
Does Ferry support mutations that return Union types such as the example snippet below?
Whenever I try to generate classes for a mutation that returns a union such as this (my graph is full of them) I get the following error:
Or is there something else going on? My apologies if this is a noob question - this is my first attempt to use ferry for a project (I'm attempting to port my existing graphql_codegen project to ferry)
The text was updated successfully, but these errors were encountered: