How to use the GraphQLNonNull function from graphql
Find comprehensive JavaScript graphql.GraphQLNonNull code examples handpicked from public code repositorys.
123 124 125 126 127 128 129 130 131 132
queryTopFields[getBy] = { type, args: { ...(primaryKeys.reduce((acc, primaryKey) => { acc[primaryKey] = { type: new graphql.GraphQLNonNull(fields[primaryKey].type) } return acc }, {})) } }
85
888
16
+ 131 other calls in file
4 5 6 7 8 9 10 11 12 13
const InputObjectType = graphql.GraphQLInputObjectType; const InterfaceType = graphql.GraphQLInterfaceType; const ScalarType = graphql.GraphQLScalarType; const ObjectType = graphql.GraphQLObjectType; const UnionType = graphql.GraphQLUnionType; const NonNullType = graphql.GraphQLNonNull; const EnumType = graphql.GraphQLEnumType; const ListType = graphql.GraphQLList; const builtInScalars = {
13
203
10
+ 3 other calls in file
49 50 51 52 53 54 55 56 57 58
}, type: { type: new _graphql.GraphQLNonNull(_graphql.GraphQLString) }, size: { type: new _graphql.GraphQLNonNull(_graphql.GraphQLInt) }, path: { type: new _graphql.GraphQLNonNull(_graphql.GraphQLString) }
5
7
3
+ 11 other calls in file
GitHub: cap-js/graphql
75 76 77 78 79 80 81 82 83 84
// filterInputObjectType is undefined if the entity only contains elements that are associations or compositions // updateInputObjectType is undefined if it is generated for an entity that only contains key elements if (!filterInputObjectType || !updateInputObjectType) return const args = { [ARGS.filter]: { type: new GraphQLNonNull(filterInputObjectType) }, [ARGS.input]: { type: new GraphQLNonNull(updateInputObjectType) } } return { type: new GraphQLList(entityObjectType), args } }
3
23
8
+ 5 other calls in file
GitHub: steventhorne/legendhub
883 884 885 886 887 888 889 890 891 892
if ((!optional || itemColumns[i].name === "Id") && !itemColumns[i].nullable && itemColumns[i].name !== "ModifiedBy" && itemColumns[i].name !== "ModifiedOn") { fields[itemColumns[i].name[0].toLowerCase() + itemColumns[i].name.slice(1)] = { type: new graphql.GraphQLNonNull(t) }; } else { fields[itemColumns[i].name[0].toLowerCase() + itemColumns[i].name.slice(1)] = { type: t }; }
3
6
0
+ 23 other calls in file
24 25 26 27 28 29 30 31 32 33
var CreateProductMutation = exports.CreateProductMutation = new _graphqlRelay.mutationWithClientMutationId({ name: 'CreateProductMutation', description: 'Function to create a product', inputFields: { name: { type: new _graphql.GraphQLNonNull(_graphql.GraphQLString) }, description: { type: _graphql.GraphQLString }, disabled: { type: _graphql.GraphQLBoolean }, startDate: { type: _graphql.GraphQLString }, endDate: { type: _graphql.GraphQLString },
1
6
4
+ 5 other calls in file
0 1 2 3 4 5 6 7 8 9
const { GraphQLID, GraphQLString, GraphQLNonNull, GraphQLObjectType, GraphQLBoolean } = require('graphql'); exports.UserType = new GraphQLObjectType({ name: 'User', fields: { id: { name: 'id', type: new GraphQLNonNull(GraphQLID) }, firstName: { name: 'firstName', type: new GraphQLNonNull(GraphQLString) }, lastName: { name: 'lastName', type: new GraphQLNonNull(GraphQLString) }, email: { name: 'email', type: new GraphQLNonNull(GraphQLString) }, isAdmin: { name: 'isAdmin', type: new GraphQLNonNull(GraphQLBoolean) }
2
1
29
+ 9 other calls in file
26 27 28 29 30 31 32 33 34 35
} else { constraintType = new ConstraintStringType(fieldName, uniqueTypeName, type, directiveArgumentMap) } } else if (type === GraphQLFloat || type === GraphQLInt) { if (notNull) { constraintType = new GraphQLNonNull(new ConstraintNumberType(fieldName, uniqueTypeName, type, directiveArgumentMap)) } else { constraintType = new ConstraintNumberType(fieldName, uniqueTypeName, type, directiveArgumentMap) } } else {
65
0
1
+ 3 other calls in file
77 78 79 80 81 82 83 84 85 86
var _this = this; if (pubSubInstance === void 0) { pubSubInstance = null; } return { type: graphql_1.GraphQLInt, description: "Delete a ".concat(modelName), args: __assign({ id: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) } }, (graphqlModelDeclaration["delete"] && graphqlModelDeclaration["delete"].extraArg ? graphqlModelDeclaration["delete"].extraArg : {})), resolve: function (source, args, context, info) { return __awaiter(_this, void 0, void 0, function () {
7
20
19
31 32 33 34 35 36 37 38 39
type: idScalar, description: 'Unique identifier for creating/updating a RiskEvidenceSynthesis record.', }, resource: { type: new GraphQLNonNull(RiskEvidenceSynthesisInput), description: 'RiskEvidenceSynthesis Information for the record.', }, };
3
14
3
+ 3 other calls in file
12 13 14 15 16 17 18 19 20 21
}); const QuoteCreateType = new GraphQLInputObjectType({ name: 'QuoteCreateType', type: QuoteType, fields: { quote: { type: new GraphQLNonNull(GraphQLString) } } }); const QuoteUpdateType = new GraphQLInputObjectType({
1
5
2
+ 13 other calls in file
23 24 25 26 27 28 29 30 31 32 33
`; const fixed = ` const { GraphQLNonNull } = require("graphql"); const fixedFields = [ { id: { type: new GraphQLNonNull(require("graphql").GraphQLID), ...require("graphql-relay").globalIdField() } }, { clearID: {} }, { sourceSystem: {} }, { loadDate: {} }, { updateDate: {} },
0
1
1
282 283 284 285 286 287 288 289 290 291
// submitted on updates if (field.nullable === false && !field.defaultValue && !constants_1.GENERATE_SPECIAL.some((flag) => field.special.includes(flag)) && action !== 'update') { type = new graphql_1.GraphQLNonNull(type); } if (collection.primary === field.field) { if (!field.defaultValue && !field.special.includes('uuid') && action === 'create') type = new graphql_1.GraphQLNonNull(graphql_1.GraphQLID);
0
0
1
+ 3138 other calls in file
129 130 131 132 133 134 135 136 137 138
if ( Object.keys(field).toString() === 'id' || collumn.type.name === 'ID' || Object.keys(field).toString() === 'globalId' ) { preField = { ...preField, type: new GraphQLNonNull(GraphQLID), ...globalIdField() }; } else { const fieldYAML = tableTypeFound.fields.find((tableTypeYAML) => tableTypeYAML.name === Object.keys(field).toString()); preField = parseFieldType(fieldYAML, preField); }
0
0
1
+ 38 other calls in file
36 37 38 39 40 41 42 43 44 45
password: { type: GraphQLNonNull(GraphQLString) }, sex: { type: GraphQLNonNull(GraphQLString) }, reference: { type: GraphQLNonNull(GraphQLString) }, userType: { type: GraphQLNonNull(GraphQLString) }, userLevel: { type: GraphQLNonNull(GraphQLString) }, membership: { type: GraphQLNonNull(GraphQLBoolean) }, verified: { type: GraphQLNonNull(GraphQLBoolean) }, coupons: { type: GraphQLList(InputUserCouponType) }, preferences: { type: GraphQLList(InputUserPreferenceType) }, guideDescription: { type: GraphQLString },
0
0
0
+ 99 other calls in file
2 3 4 5 6 7 8 9 10 11
global.__base = path.normalize(__dirname + '/..'); global.GraphqlSchema = global.GraphQLSchema = graphql.GraphQLSchema; global.GraphqlObjectType = global.GraphQLObjectType = graphql.GraphQLObjectType; global.GraphqlList = global.GraphQLList = graphql.GraphQLList; global.GraphqlNonNull = global.GraphQLNonNull = graphql.GraphQLNonNull; global.GraphqlUnionType = global.GraphQLUnionType = graphql.GraphQLUnionType; global.GraphqlInterfaceType = global.GraphQLInterfaceType = graphql.GraphQLInterfaceType; global.GraphqlEnumType = global.GraphQLEnumType = graphql.GraphQLEnumType; global.GraphqlInt = global.GraphQLInt = graphql.GraphQLInt;
0
0
5
74 75 76 77 78 79 80 81 82 83
addClient: { type: ClientType, args: { name: { type: GraphQLNonNull(GraphQLString) }, email: { type: GraphQLNonNull(GraphQLString) }, phone: { type: GraphQLNonNull(GraphQLString) }, }, resolve(parent, args) { const client = new Client({ name: args.name,
0
0
0
+ 8 other calls in file
31 32 33 34 35 36 37 38 39 40 41
} const deleteEvent = { type: EventType, args: { eventDate: { type: GraphQLNonNull(GraphQLString) }, eventTrip: { type: GraphQLNonNull(GraphQLString) } }, async resolve(_, { eventDate, eventTrip }, { verifiedUser }) { if (!verifiedUser) throw new Error("Debes iniciar sesion para realizar esta accion");
0
0
0
+ 7 other calls in file
GitHub: Eduart80/graphql
94 95 96 97 98 99 100 101 102 103
}, //delete client deleteClient: { type: ClientType, args: { id: { type: GraphQLNonNull(GraphQLID) } }, resolve(parent, args) { return Client.findByIdAndRemove(args.id) }
0
0
0
+ 19 other calls in file
313 314 315 316 317 318 319 320 321 322
// note the GraphQLNonNull and GraphQLList constructors are incorrectly // not generic over their inner type which is why we have to use as // (the classes are generic but not the constructors) function getTypeForField(originalType) { if (originalType instanceof graphql.GraphQLNonNull) { return new graphql.GraphQLNonNull(getTypeForField(originalType.ofType)); } if (originalType instanceof graphql.GraphQLList) { return new graphql.GraphQLList(getTypeForField(originalType.ofType)); }
0
0
1
+ 8 other calls in file
graphql.GraphQLNonNull is the most popular function in graphql (4226 examples)