Skip to content
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

deprecated onTypeConflict substitution? #863

Closed
terion-name opened this issue Jun 24, 2018 · 12 comments
Closed

deprecated onTypeConflict substitution? #863

terion-name opened this issue Jun 24, 2018 · 12 comments
Labels
feature New addition or enhancement to existing solutions schema stitching

Comments

@terion-name
Copy link

`onTypeConflict` is deprecated. Use schema transforms to customize merging logic.

well, ok. but how to mimic onTypeConflict with transforms? I need literally merge duplicating types and handle this merging process. How to do this via transforms?

@stubailo stubailo added the docs Focuses on documentation changes label Jul 13, 2018
@joeflack4
Copy link

+1

@stubailo
Copy link
Contributor

stubailo commented Aug 2, 2018

@joeflack4 I'm current working on removing this and providing a good alternative; it looks like in the example you provided, onTypeConflict is not really used; only to select the first type that shows up.

@terion-name would it work for you if merging types was the only option and always done? And then if you wanted to remove or rename fields you do that with a transform?

@stubailo stubailo added feature New addition or enhancement to existing solutions schema stitching and removed docs Focuses on documentation changes labels Aug 2, 2018
@terion-name
Copy link
Author

@stubailo merging types how? Let's assume I have two conflicting types: Article {id title} and Article {id slug}. How merger would merge them? Article {id title slug}? And what if title has different types? Or there are some relations? I don't think automerging will work for most cases. And I really don't understand, why onTypeConflict is deprecated. It is really convenient thing that provides control in complex scenarios (I use it on my gateway that is very complex and onTypeConflict really helps alot)

@dncrews
Copy link

dncrews commented Sep 13, 2018

@stubailo: what I'm looking for is this "left-first" solution. Is the correct answer to just reverse the array (i.e. order matters, similar to Object.assign)?

@Tehnix
Copy link

Tehnix commented Sep 17, 2018

Did anyone figure out how to replace onTypeConflict with "Use schema transforms to customize merging logic"?

We are simply just checking if you have a conflicting type, and then throwing an error, which'll be caught in our integration-test flow.

@thehappycoder
Copy link

I have the same use-case as @Tehnix and I am trying to figure out how to do that with transformations. In my case, the names of root fields in the schemas are not known in advance, so it's probably impossible to implement with transformations.

@fgrehm
Copy link

fgrehm commented Dec 10, 2018

Apparently the option's use got completely removed by @stubailo here :-(

I'm not seeing much use of argument based on this search and mergeSchemas does not seem to be using the argument as well.

@kommander
Copy link

I have the same use case as @Tehnix and just put together a tool to also check for field collisions on object types before merging. Would it maybe make sense putting this with the stitching tools?
Here's a diff: master...kommander:feature/add-standalone-find-type-conflict

Otherwise I'll just release it as npm module on its own.

@thehappycoder
Copy link

@kommander Did you end up publishing it as a package?

@kommander
Copy link

@thehappycoder nope, it ended up as part of the project codebase 😦

@yaacovCR
Copy link
Collaborator

onTypeConflict is back in graphql-tools-fork https://www.npmjs.com/package/graphql-tools-fork

@yaacovCR
Copy link
Collaborator

Folded into #1306

@yaacovCR yaacovCR mentioned this issue Mar 30, 2020
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New addition or enhancement to existing solutions schema stitching
Projects
None yet
Development

No branches or pull requests

9 participants