-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ const ContactInfo = builder.simpleObject('ContactInfo', { | |
email: t.string({ | ||
nullable: false, | ||
}), | ||
phoneNUmber: t.string({ | ||
phoneNumber: t.string({ | ||
nullable: true, | ||
}), | ||
}), | ||
|
@@ -49,23 +49,26 @@ const Node = builder.simpleInterface('Node', { | |
}), | ||
}); | ||
|
||
const UserType = builder.simpleObject('User', { | ||
interfaces: [Node], | ||
fields: (t) => ({ | ||
firstName: t.string(), | ||
lastName: t.string(), | ||
contactInfo: t.field({ | ||
type: ContactInfo, | ||
nullable: false, | ||
const UserType = builder.simpleObject( | ||
'User', | ||
{ | ||
interfaces: [Node], | ||
fields: (t) => ({ | ||
firstName: t.string(), | ||
lastName: t.string(), | ||
contactInfo: t.field({ | ||
type: ContactInfo, | ||
nullable: false, | ||
}), | ||
}), | ||
}), | ||
// You can add aditional fields with resolvers with a third fields argument | ||
}, | ||
// You can add additional fields with resolvers with a third fields argument | ||
(t) => ({ | ||
fullName: t.string({ | ||
resolve: (user) => `${user.firstName} ${user.lastName}`, | ||
}), | ||
}) | ||
}); | ||
}), | ||
); | ||
|
||
builder.queryType({ | ||
fields: (t) => ({ | ||
|
@@ -81,7 +84,7 @@ builder.queryType({ | |
lastName: 'Organa', | ||
contactInfo: { | ||
email: '[email protected]', | ||
phoneNUmber: null, | ||
phoneNumber: null, | ||
}, | ||
}; | ||
}, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.