We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11b0136 commit f812c26Copy full SHA for f812c26
index.js
@@ -4,7 +4,9 @@ const {
4
GraphQLInt,
5
GraphQLFloat,
6
GraphQLNonNull,
7
- GraphQLString
+ GraphQLString,
8
+ isWrappingType,
9
+ isNamedType
10
} = require('graphql')
11
const { SchemaDirectiveVisitor } = require('graphql-tools')
12
const ConstraintStringType = require('./scalars/string')
@@ -61,6 +63,17 @@ class ConstraintDirective extends SchemaDirectiveVisitor {
61
63
} else {
62
64
throw new Error(`Not a scalar type: ${field.type}`)
65
}
66
+
67
+ const typeMap = this.schema.getTypeMap();
68
+ let type = field.type;
69
70
+ if (isWrappingType(type)) {
71
+ type = type.ofType;
72
+ }
73
74
+ if (isNamedType(type) && !typeMap[type.name]) {
75
+ typeMap[type.name] = type;
76
77
78
79
0 commit comments