Skip to content

Commit df54e25

Browse files
feat(): some content tweaks
1 parent 3e124fd commit df54e25

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

content/openapi/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ async function bootstrap() {
4242
bootstrap();
4343
```
4444

45+
> info **Hint** `document` (returned by the `SwaggerModule#createDocument()` method) 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.
46+
4547
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.
4648

4749
Once we create a document, we can call the `setup()` method. It accepts:
@@ -64,8 +66,6 @@ The `SwaggerModule` automatically reflects all of your endpoints. Note that the
6466

6567
> info **Hint** To generate and download a Swagger JSON file, navigate to `http://localhost:3000/api-json` (`swagger-ui-express`) or `http://localhost:3000/api/json` (`fastify-swagger`) in your browser (assuming that your Swagger documentation is available under `http://localhost:3000/api`).
6668
67-
> `const document` above 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.
68-
6969
#### Example
7070

7171
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/11-swagger).

content/techniques/mongo.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ In case there are multiple owners, your property configuration should look as fo
8787
```typescript
8888
@Prop({ type: [Types.ObjectId], ref: Owner.name })
8989
owner: Owner[];
90+
```
91+
9092
Finally, the **raw** schema definition can also be passed to the decorator. This is useful when, for example, a property represents a nested object which is not defined as a class. For this, use the `raw()` function from the `@nestjs/mongoose` package, as follows:
9193

9294
```typescript

package-lock.json

Lines changed: 34 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)