We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbf0cff commit b8806d0Copy full SHA for b8806d0
src/directives/currency.ts
@@ -20,6 +20,11 @@ const currencyDirective = (directiveName: string = 'currency') => {
20
return {
21
...fieldConfig,
22
resolve: async (source, args, context, info) => {
23
+ const { fieldName, returnType } = info
24
+ const type = returnType.toString()
25
+ if (type !== 'String') {
26
+ throw new GraphQLError(`Unable to validate field "${fieldName}" of type ${type}. @currency directive can only be used on scalar type String`)
27
+ }
28
const value = await resolve(source, args, context, info)
29
try {
30
const response = await fetch(`https://www.google.com/search?q=${value}+${from}+to+${to}+&hl=en`)
0 commit comments