Skip to content

Commit 0fefd67

Browse files
authored
docs(openapi): handle mapped-types and add build steps
Closes #1959
1 parent 3563d2b commit 0fefd67

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

content/openapi/cli-plugin.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export class CreateUserDto {
5353
}
5454
```
5555

56+
> info **Hint** When using `PartialType, OmitType, PickType, IntersectionType` in dtos import them from `@nestjs/swagger` instead of `@nestjs/mapped-types` for the plugin to pick up the schema
57+
5658
The plugin adds appropriate decorators on the fly based on the **Abstract Syntax Tree**. Thus you won't have to struggle with `@ApiProperty` decorators scattered throughout the code.
5759

5860
> info **Hint** The plugin will automatically generate any missing swagger properties, but if you need to override them, you simply set them explicitly via `@ApiProperty()`.
@@ -184,6 +186,25 @@ export interface PluginOptions {
184186
</tr>
185187
</table>
186188

189+
On the first run and when ever plugin options are changed. Delete `/dist` folder and build the application using
190+
191+
```bash
192+
$ nest build
193+
```
194+
195+
Or you can configure `package.json` with the following scripts
196+
197+
```json
198+
"prebuild": "rimraf dist",
199+
"build": "nest build",
200+
```
201+
202+
and run it using
203+
204+
```bash
205+
$ npm run build
206+
```
207+
187208
If you don't use the CLI but instead have a custom `webpack` configuration, you can use this plugin in combination with `ts-loader`:
188209

189210
```javascript

0 commit comments

Comments
 (0)