You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/graphql/resolvers-map.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,10 +167,10 @@ We can define multiple `@Query()` resolver functions (both within this class, an
167
167
In the above examples, the `@Query()` decorator generates a GraphQL schema query type name based on the method name. For example, consider the following construction from the example above:
This generates the following entry for the author query in our schema (the query type uses the same name as the method name):
@@ -356,10 +356,10 @@ In this case (`@Resolver()` decorator at the method level), if you have multiple
356
356
In the above examples, the `@Query()` and `@ResolveField()` decorators are associated with GraphQL schema types based on the method name. For example, consider the following construction from the example above:
357
357
358
358
```typescript
359
-
@Query()
360
-
asyncauthor(@Args('id') id: number) {
361
-
returnthis.authorsService.findOneById(id);
362
-
}
359
+
@Query()
360
+
asyncauthor(@Args('id') id: number) {
361
+
returnthis.authorsService.findOneById(id);
362
+
}
363
363
```
364
364
365
365
This generates the following entry for the author query in our schema (the query type uses the same name as the method name):
@@ -510,7 +510,7 @@ The GraphQL plugin will automatically:
510
510
- set the `nullable` property depending on the question mark (e.g. `name?: string` will set `nullable: true`)
511
511
- set the `type` property depending on the type (supports arrays as well)
512
512
513
-
Please, note that your filenames **must have** one of the following suffixes in order to be analyzed by the plugin: `['.input.ts', '.args.ts', '.entity.ts']` (e.g., `author.entity.ts`). If you are using a different suffix, you can adjust the plugin's behavior by specifying the `typeFileNameSuffix` option (see below).
513
+
Please, note that your filenames **must have** one of the following suffixes in order to be analyzed by the plugin: `['.input.ts', '.args.ts', '.entity.ts', '.model.ts']` (e.g., `author.entity.ts`). If you are using a different suffix, you can adjust the plugin's behavior by specifying the `typeFileNameSuffix` option (see below).
514
514
515
515
With what we've learned so far, you have to duplicate a lot of code to let the package know how your type should be declared in GraphQL. For example, you could define a simple `Author` class as follows:
0 commit comments