-
Notifications
You must be signed in to change notification settings - Fork 251
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
Move __resolveReference
resolvers on to extensions
#1746
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { GraphQLResolveInfo } from 'graphql'; | ||
|
||
type GraphQLReferenceResolver<TContext> = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file isn't imported from anywhere? Is it referenced in some config file that I'm missing? Why is it in gateway-js rather than subgraph-js? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, i see, there's a second copy in subgraph-js. well, maybe my other suggestion will let us remove the duplication. and i guess as long as a file is included in the tsconfig'd project, it doesn't have to be imported for its There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i do wonder though — if the file's not imported from anywhere, will the declare modules work across package? ie, this file generates a .d.ts that isn't sourced from index.d.ts, will it 'take effect' in the same way that it takes effect when you're actively building the package itself? i mean maybe it doesn't matter since this is kinda an internal implementation detail of |
||
reference: object, | ||
context: TContext, | ||
info: GraphQLResolveInfo, | ||
) => any; | ||
|
||
interface ApolloSubgraphExtensions<TContext> { | ||
resolveReference?: GraphQLReferenceResolver<TContext>; | ||
} | ||
|
||
declare module 'graphql/type/definition' { | ||
interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { | ||
apollo?: { | ||
subgraph?: ApolloSubgraphExtensions<_TContext>; | ||
} | ||
} | ||
|
||
interface GraphQLInterfaceTypeExtensions<_TSource = any, _TContext = any> { | ||
apollo?: { | ||
subgraph?: ApolloSubgraphExtensions<_TContext>; | ||
} | ||
} | ||
|
||
interface GraphQLUnionTypeExtensions<_TSource = any, _TContext = any> { | ||
apollo?: { | ||
subgraph?: ApolloSubgraphExtensions<_TContext>; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trevor-scheer is this basically just for
resolveType
on abstract types andisTypeOf
on object types? wonder if we should just special case them (which lets us drop thetype as any
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it looks like this entire directory (
gateway-js/src/schema-helper
, not to be confused withsubgraph-js/src/schema-helper
) is only used in tests? Can it be moved intogateway-js/src/__tests__
, or maybe you can just use the version insubgraph-js
directly from the tests?