Skip to content

Commit d33bb13

Browse files
authored
Fix root being inside of DSL in mutations-and-input-types.mdx
The example shows graphql implementation, where the "root" is by mistake put as string as part of the schema definition instead being a native js const
1 parent 9032db1 commit d33bb13

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

website/pages/docs/mutations-and-input-types.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,21 @@ type Query {
230230
getMessages: [Message]
231231
}
232232
233+
type Mutation {
234+
createMessage(input: MessageInput): Message
235+
updateMessage(id: ID!, input: MessageInput): Message
236+
}
237+
`);
238+
239+
// If Message had any complex fields, we'd put them on this object.
240+
class Message {
241+
constructor(id, { content, author }) {
242+
this.id = id;
243+
this.content = content;
244+
this.author = author;
245+
}
246+
}
247+
233248
const root = {
234249
getMessage: ({ id }) => {
235250
return fakeDatabase[id]
@@ -250,21 +265,6 @@ const root = {
250265
}
251266
}
252267

253-
type Mutation {
254-
createMessage(input: MessageInput): Message
255-
updateMessage(id: ID!, input: MessageInput): Message
256-
}
257-
`);
258-
259-
// If Message had any complex fields, we'd put them on this object.
260-
class Message {
261-
constructor(id, { content, author }) {
262-
this.id = id;
263-
this.content = content;
264-
this.author = author;
265-
}
266-
}
267-
268268
const app = express();
269269
app.all(
270270
'/graphql',

0 commit comments

Comments
 (0)