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

Schema stitching and transforms to remove ID pointers #1118

Closed
wabrit opened this issue Apr 30, 2019 · 7 comments
Closed

Schema stitching and transforms to remove ID pointers #1118

wabrit opened this issue Apr 30, 2019 · 7 comments

Comments

@wabrit
Copy link

wabrit commented Apr 30, 2019

With reference to the example of Chirps and Authors outlined here, I want to hide the Chirp.authorId field from API clients so that they only see the "stitched" field Chirp.author.

Having attempted this with a bespoke schema transform it appears not to be possible as the fragment needed for the stitching relies on authorId. Have I missed something, or is there an alternative approach; having both fields exposed seems a bit of an anti-pattern.

@yaacovCR
Copy link
Collaborator

yaacovCR commented May 2, 2019

Filtering out specific fields of objects, that has been requested in #819, with pending pull request #964, but no recent traction...

@wabrit
Copy link
Author

wabrit commented May 4, 2019

Thanks - yes I saw that PR. The problem isn't the lack of such a filter, but the fact that it can't be applied to a field used as the fragment id in stitching without breaking stitching itself.

@yaacovCR
Copy link
Collaborator

yaacovCR commented May 5, 2019

I haven't actually used that transform myself, as it is not yet been merged. but I would think either (a) merging the transformed schema and then delegating to the original schema or (b) transforming the merged schema would work... Are you able to share the code you have worked on so far?

@yaacovCR
Copy link
Collaborator

yaacovCR commented May 5, 2019

Ah, I think I get why (a) doesn't work. What about (b)?

@yaacovCR
Copy link
Collaborator

In particular, I mean something along the lines of

transformSchema(mergeSchemas(...), [myFilteringFieldTransform])

@yaacovCR
Copy link
Collaborator

In graphql-tools-fork, you can do this without another delegation layer with just filterSchema({ schema: mergeSchemas(...), ...options }).

Progress!

@yaacovCR
Copy link
Collaborator

Type merging is better solution, see #1306

@yaacovCR yaacovCR mentioned this issue Mar 29, 2020
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants