Skip to content

Commit 59951e0

Browse files
committed
fix(visitAllArgs): fix method name visitAllArgs to match documentation
provide relevant argument definition in the info object describe this in README
1 parent 97c4b70 commit 59951e0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ export const visitAllArgs = (
132132
config: IConfig
133133
): IMiddleware
134134

135+
// Note that the visitor and transform functions receive all four resolver args (parent, args, context, & info),
136+
// For these functions, info.argument has been set to refer to the relevant argument definition.
137+
135138
// input and output types are up to you, just provide the transform function
136139
interface IFile {
137140
stream: string

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export function makeArgumentTransform<T, V>(
115115
| V
116116
| Promise<V>
117117
| Array<V | Promise<V>> = getArgumentValue(args, argumentDef)
118+
info.argument = argumentDef
118119
if (Array.isArray(argumentValue)) {
119120
return Promise.all(
120121
argumentValue.reduce(
@@ -211,7 +212,7 @@ export function processTypeArgs<V, T>({
211212
}
212213
}
213214

214-
export function processArgs({ visitor }): IMiddlewareFunction {
215+
export function visitAllArgs({ visitor }): IMiddlewareFunction {
215216
return (resolve, parent, args, ctx, info) => {
216217
const argDefs = getFieldArguments(info)
217218
if (argDefs.length) {

0 commit comments

Comments
 (0)