Skip to content

Commit 941126b

Browse files
committed
fixup! docs(openapi): prefer lazy over eager creation of the document
1 parent 7ad1deb commit 941126b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/openapi/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async function bootstrap() {
3737
bootstrap();
3838
```
3939

40-
> info **Hint** The return of `SwaggerModule#createDocument()` is a serializable object conforming to [OpenAPI Document](https://swagger.io/specification/#openapi-document). Instead of hosting it via HTTP, you could also save it as a JSON/YAML file, and consume it in different ways.
40+
> info **Hint** The factory around `SwaggerModule#createDocument()` is only used to create the document when you actually request Swagger, saving some initialization time and is a serializable object conforming to [OpenAPI Document](https://swagger.io/specification/#openapi-document). Instead of hosting it via HTTP, you could also save it as a JSON/YAML file, and consume it in different ways.
4141
4242
The `DocumentBuilder` helps to structure a base document that conforms to the OpenAPI Specification. It provides several methods that allow setting such properties as title, description, version, etc. In order to create a full document (with all HTTP routes defined) we use the `createDocument()` method of the `SwaggerModule` class. This method takes two arguments, an application instance and a Swagger options object. Alternatively, we can provide a third argument, which should be of type `SwaggerDocumentOptions`. More on this in the [Document options section](/openapi/introduction#document-options).
4343

0 commit comments

Comments
 (0)