Skip to content

Commit

Permalink
Update simple-objects.mdx
Browse files Browse the repository at this point in the history
Update formatting for Simple Objects plugin documentation to match plugin expectations
  • Loading branch information
nathanchapman authored Jul 20, 2023
1 parent 62c9be9 commit 8e10601
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions website/pages/docs/plugins/simple-objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ContactInfo = builder.simpleObject('ContactInfo', {
email: t.string({
nullable: false,
}),
phoneNUmber: t.string({
phoneNumber: t.string({
nullable: true,
}),
}),
Expand All @@ -63,23 +63,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 additional fields with resolvers with a third fields argument
(t) => ({
fullName: t.string({
resolve: (user) => `${user.firstName} ${user.lastName}`,
}),
}),
}),
// You can add aditional fields with resolvers with a third fields argument
(t) => ({
fullName: t.string({
resolve: (user) => `${user.firstName} ${user.lastName}`,
}),
})
});
);

builder.queryType({
fields: (t) => ({
Expand All @@ -95,7 +98,7 @@ builder.queryType({
lastName: 'Organa',
contactInfo: {
email: '[email protected]',
phoneNUmber: null,
phoneNumber: null,
},
};
},
Expand Down

0 comments on commit 8e10601

Please sign in to comment.