Skip to content

Commit fa6bfba

Browse files
docs(): update to generating sdl, add accessing schema section
1 parent 6d4396b commit fa6bfba

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

content/graphql/quick-start.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@ definitionsFactory.generate({
171171

172172
A fully working schema first sample is available [here](https://github.com/nestjs/nest/tree/master/sample/12-graphql-schema-first).
173173

174+
#### Accessing generated schema
175+
176+
To access the generated schema (in either code first or schema first approach), use the `GraphQLHost` class:
177+
178+
```typescript
179+
const { schema } = app.get(GraphQLSchemaHost);
180+
```
181+
182+
> info **Hint** Make sure to call the `GraphQLSchemaHost#schema` getter when the application is already initialized (after the `onModuleInit` hook triggered by either `app.listen()` or `app.init()` method.
183+
174184
#### Async configuration
175185

176186
When you need to pass module options asynchronously instead of statically, use the `forRootAsync()` method. As with most dynamic modules, Nest provides several techniques to deal with async configuration.

content/graphql/schema-generator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
### Schema generator
1+
### Generating SDL
22

33
##### This chapter applies only to code first approach
44

5-
To manually build (without running an application) a GraphQL schema, use the `GraphQLSchemaBuilderModule`.
5+
To manually generate (without running an application, connecting to the database, hooking up resolvers, etc.) a GraphQL SDL, use the `GraphQLSchemaBuilderModule`.
66

77
```typescript
88
async function generateSchema() {

src/app/homepage/menu/menu.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class MenuComponent implements OnInit {
114114
{ title: 'Unions', path: '/graphql/unions' },
115115
{ title: 'Enums', path: '/graphql/enums' },
116116
{ title: 'Mapped types', path: '/graphql/mapped-types' },
117-
{ title: 'Schema generator', path: '/graphql/schema-generator' },
117+
{ title: 'Generating SDL', path: '/graphql/generating-sdl' },
118118
{
119119
title: 'Other features',
120120
path: '/graphql/tooling',

src/app/homepage/pages/graphql/graphql.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ const routes: Routes = [
9292
data: { title: 'GraphQL + TypeScript - Mapped types' },
9393
},
9494
{
95-
path: 'schema-generator',
95+
path: 'generating-sdl',
9696
component: SchemaGeneratorComponent,
97-
data: { title: 'GraphQL + TypeScript - Schema generator' },
97+
data: { title: 'GraphQL + TypeScript - Generating SDL' },
9898
},
9999
];
100100

0 commit comments

Comments
 (0)