Skip to content

Commit 4be7b28

Browse files
Merge pull request #3150 from kasir-barati/master
fix: better wording + adding a hint about typing nullable fields
2 parents e17a6ea + 3064337 commit 4be7b28

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

content/graphql/resolvers-map.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The type function is required when there's the potential for ambiguity between t
6767

6868
The options object can have any of the following key/value pairs:
6969

70-
- `nullable`: for specifying whether a field is nullable (in SDL, each field is non-nullable by default); `boolean`
70+
- `nullable`: for specifying whether a field is nullable (in `@nestjs/graphql`, each field is non-nullable by default); `boolean`
7171
- `description`: for setting a field description; `string`
7272
- `deprecationReason`: for marking a field as deprecated; `string`
7373

content/graphql/subscriptions.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ GraphQLModule.forRoot<ApolloDriverConfig>({
3434

3535
To create a subscription using the code first approach, we use the `@Subscription()` decorator (exported from the `@nestjs/graphql` package) and the `PubSub` class from the `graphql-subscriptions` package, which provides a simple **publish/subscribe API**.
3636

37-
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
37+
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterableIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
3838

3939
```typescript
4040
const pubSub = new PubSub();
@@ -44,7 +44,7 @@ export class AuthorResolver {
4444
// ...
4545
@Subscription(() => Comment)
4646
commentAdded() {
47-
return pubSub.asyncIterator('commentAdded');
47+
return pubSub.asyncIterableIterator('commentAdded');
4848
}
4949
}
5050
```
@@ -68,7 +68,7 @@ Note that subscriptions, by definition, return an object with a single top level
6868
name: 'commentAdded',
6969
})
7070
subscribeToCommentAdded() {
71-
return pubSub.asyncIterator('commentAdded');
71+
return pubSub.asyncIterableIterator('commentAdded');
7272
}
7373
```
7474

@@ -111,7 +111,7 @@ To filter out specific events, set the `filter` property to a filter function. T
111111
payload.commentAdded.title === variables.title,
112112
})
113113
commentAdded(@Args('title') title: string) {
114-
return pubSub.asyncIterator('commentAdded');
114+
return pubSub.asyncIterableIterator('commentAdded');
115115
}
116116
```
117117

@@ -124,7 +124,7 @@ To mutate the published event payload, set the `resolve` property to a function.
124124
resolve: value => value,
125125
})
126126
commentAdded() {
127-
return pubSub.asyncIterator('commentAdded');
127+
return pubSub.asyncIterableIterator('commentAdded');
128128
}
129129
```
130130

@@ -140,7 +140,7 @@ If you need to access injected providers (e.g., use an external service to valid
140140
}
141141
})
142142
commentAdded() {
143-
return pubSub.asyncIterator('commentAdded');
143+
return pubSub.asyncIterableIterator('commentAdded');
144144
}
145145
```
146146

@@ -154,7 +154,7 @@ The same construction works with filters:
154154
}
155155
})
156156
commentAdded() {
157-
return pubSub.asyncIterator('commentAdded');
157+
return pubSub.asyncIterableIterator('commentAdded');
158158
}
159159
```
160160

@@ -170,7 +170,7 @@ export class AuthorResolver {
170170
// ...
171171
@Subscription()
172172
commentAdded() {
173-
return pubSub.asyncIterator('commentAdded');
173+
return pubSub.asyncIterableIterator('commentAdded');
174174
}
175175
}
176176
```
@@ -183,7 +183,7 @@ To filter out specific events based on context and arguments, set the `filter` p
183183
payload.commentAdded.title === variables.title,
184184
})
185185
commentAdded() {
186-
return pubSub.asyncIterator('commentAdded');
186+
return pubSub.asyncIterableIterator('commentAdded');
187187
}
188188
```
189189

@@ -194,7 +194,7 @@ To mutate the published payload, we can use a `resolve` function.
194194
resolve: value => value,
195195
})
196196
commentAdded() {
197-
return pubSub.asyncIterator('commentAdded');
197+
return pubSub.asyncIterableIterator('commentAdded');
198198
}
199199
```
200200

@@ -208,7 +208,7 @@ If you need to access injected providers (e.g., use an external service to valid
208208
}
209209
})
210210
commentAdded() {
211-
return pubSub.asyncIterator('commentAdded');
211+
return pubSub.asyncIterableIterator('commentAdded');
212212
}
213213
```
214214

@@ -222,7 +222,7 @@ The same construction works with filters:
222222
}
223223
})
224224
commentAdded() {
225-
return pubSub.asyncIterator('commentAdded');
225+
return pubSub.asyncIterableIterator('commentAdded');
226226
}
227227
```
228228

@@ -369,7 +369,7 @@ GraphQLModule.forRoot<MercuriusDriverConfig>({
369369

370370
To create a subscription using the code first approach, we use the `@Subscription()` decorator (exported from the `@nestjs/graphql` package) and the `PubSub` class from the `mercurius` package, which provides a simple **publish/subscribe API**.
371371

372-
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
372+
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterableIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
373373

374374
```typescript
375375
@Resolver(() => Author)

0 commit comments

Comments
 (0)