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

Generate SDKs for the untransformed source schemas #3482

Closed
leemhenson opened this issue Jan 14, 2022 · 0 comments
Closed

Generate SDKs for the untransformed source schemas #3482

leemhenson opened this issue Jan 14, 2022 · 0 comments

Comments

@leemhenson
Copy link

leemhenson commented Jan 14, 2022

Related to #3367.

I want to be able to filter out certain fields in the source schema, but still be able to use that source's SDK to query that field. For example, I might write an additional typedef that matches the same type as the filtered field, and a custom resolver for it that queries the filtered field in the source, supplying the selection set from client query.

At the moment I can't do this, because filtering a field removes it from the SDK. I can work around it by renaming the field to "make space" in the stitched schema for the additional typedef, and then using a root-level filter to hide the renamed field. However, this makes the meshrc unnecessarily complicated, and means I have to refer to the renamed field on the SDK, rather than the original name. This also complicates thing unnecessarily.

Describe the solution you'd like

I can think of a couple of options:

a) Generate an SDK for the untransformed source schema, and place it in the context alongside the SDK that's currently being generated for the transformed source schema. e.g. something like

context.SpaceX.launch(id); // current, transformed SDK
context.SpaceXRaw.launch(id); // new, untransformed SDK

This is simple, but wouldn't allow the usage of any useful transforms like caches. We'd also have to think about name collisions.

b) Have the ability to define a source which is never actually stitched. This would allow the use of transforms, and the developer would be responsible for choosing the name.

My preference is for (b) and I will start building a PR for that, but I'm interested to hear about other opinions.

@leemhenson leemhenson mentioned this issue Jan 14, 2022
12 tasks
@ardatan ardatan closed this as completed Mar 30, 2022
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

Successfully merging a pull request may close this issue.

2 participants