-
Notifications
You must be signed in to change notification settings - Fork 342
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
Filtering a source schema also filters that schema's SDK #3367
Comments
Spent a bit of time debugging why using a root filter transform would break typescript declaration emit during
export type QueryAuthorServiceSdk = {
author: InContextSdkMethod<Query['author'], QueryauthorArgs, MeshContext>
// ... other definitions
}; The problem is that the This all happens during If you've got any guidance on where you would see this going, I'm all ears! |
I've added a draft PR with a naive implementation that works for me. ^ |
Thank you @leemhenson ! I'll take a look soon! |
A bit of extra information - the patch I've got doesn't work when the name of a field has been renamed. I'm expecting the pascal-cased version of the field name to match the name of the Args type in the subschema, but after the rename of course it won't. |
Describe the bug
I want to filter a source schema so that some of it's members don't appear in my stitched schema. I think there are two ways of doing that:
When I try option 1, it works in that my stitched schema doesn't show those members. However, if I attempt to use the source's sdk from a custom resolver's context, I find those members are also filtered out and I can't query it.
When I try option 2, the Typescript declarations file is not emitted to
.mesh/index.d.ts
. This obviously kills all the typescript code in my project that depends on those types.To Reproduce
Steps to reproduce the behavior:
Sandbox for option 1: https://codesandbox.io/s/hungry-montalcini-57ge6?file=/resolver.ts
You can see there are no members available on the
AuthorService.Query
type. If you comment out the transforms in the meshrc and rerun yarn build, the type is then populated.Sandbox for option 2: https://codesandbox.io/s/condescending-swanson-9n0ux?file=/.mesh/schema.graphql
If you run
yarn build
you will see that no typescript declarations are emitted into the.mesh
directory.Expected behavior
I can see an argument for saying that transforms applied to the source schema should be reflected in that source schema's context sdk. If that's the case, root transforms must correctly emit the typescript declarations. Alternatively, it seems equally valid to say that the context sdk should be a true reflection of the upstream schema, and source transforms should only apply during the stitching.
Environment:
"@graphql-mesh/cli": "^0.44.4"
"@graphql-mesh/graphql": "^0.20.9"
"@graphql-mesh/transform-filter-schema": "^0.14.5"
The text was updated successfully, but these errors were encountered: