-
Notifications
You must be signed in to change notification settings - Fork 66
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
Merge all GraphQL types? #113
Comments
@dotansimha The What other types are you trying to merge? And we are always happy to accept PR's to improve/maintain this package. 😄 Maybe @RodMachado the original author might be able to better answer your question. |
@RodMachado @cfnelson |
@dotansimha I believe this has been discussed at some point in the past but am unsure of the details. Will need to ask @RodMachado to clarify if there was a discussion and the outcome of it. If I understand your suggestion correctly my main concern and I assume there will always be a contentious issue around what the expected behaviour should be and if we should allow/support resolving two of the same types together which would allow a scenario where you are trying to merge |
Hey @dotansimha, @cfnelson is right, we did have this discussion before and decided not to support multiple declarations for the same type. Consider a scenario where there's a file A with Another scenario could be having I know these are not the most elaborate examples, but I'm sure you can see how these could lead to some hard to debug or maintainability issues. Isn't it better to know that someone already created a type and that all fields are specified the same place? Give it a thought. Maybe there are scenarios where this could be beneficial that we are not considering. I would love to hear your opinion. Cheers! |
I would have following use case for merging every type together: Granted, this is quite specific but with the rise of apollo client and typescript I can see this becoming a feature more devs would want. Regarding the edge cases mentioned by @RodMachado: Why not just throw an error when finding fields with the same name that have different types and let the dev resolve it. |
I don't know @kohlikohl (yet? 😉) , but it appears we've had the same requirements at the same time :) would love to voice support for the |
So I tried the code from PR #118 and it does exactly what I need. |
|
I was wondering why this package merges (without
extend type
) only Query, Mutation and Subscription. The logic I refer to is this: https://github.com/okgrow/merge-graphql-schemas/blob/master/src/merge_types.js#L8I tried to create a version of this package without this constraint and everything works, and I can just write
type User { A: String }
and merge it withtype User { B: String }
(without the need forextend type
).The text was updated successfully, but these errors were encountered: