Skip to content

Commit

Permalink
Display SDL tab
Browse files Browse the repository at this point in the history
  • Loading branch information
denisborovikov committed Jan 12, 2021
1 parent abe7841 commit 837904f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ We need to get the client's input data to complete our resolver. This brings us
Let's revise our implementation with GraphQL arguments.
<TabbedContent tabs={['Diff', 'Code']}>
<TabbedContent tabs={['Diff', 'Code', 'SDL']}>
<tab>
Expand Down Expand Up @@ -340,7 +340,7 @@ export const PostMutation = extendType({
</tab>
</TabbedContent>
<tab>
```ts
Mutation {
Expand All @@ -349,6 +349,10 @@ Mutation {
}
```
</tab>
</TabbedContent>
1. Add an `args` property to the field definition to define its args. Keys are arg names and values are type specifications.
2. Use the Nexus helpers for defining an arg type. There is one such helper for every GraphQL scalar such as `intArg` and `booleanArg`. If you want to reference a type like some InputObject then use `arg({ type: "..." })`. You can use the helpers `nonNull` and `nullable` to adjust the nullability type of the arg. You can use the functional helper `list` to turn the arg into a list type too.
3. In our resolver, access the args we specified above and pass them through to our custom logic. If you hover over the `args` parameter you'll see that Nexus has properly typed them including the fact that they cannot be undefined.
Expand Down

0 comments on commit 837904f

Please sign in to comment.