Skip to content

Commit 441f907

Browse files
Merge branch 'master' of https://github.com/nestjs/docs.nestjs.com; branch 'examples-of-examples' of https://github.com/fbartkow-from-f/docs.nestjs.com into fbartkow-from-f-examples-of-examples
2 parents 5ffa7ad + cd5b547 commit 441f907

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

content/openapi/types-and-parameters.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,31 @@ CatBreed:
203203

204204
> info **Hint** Any **decorator** that takes `enum` as a property will also take `enumName`.
205205

206+
#### Examples Of Properties
207+
208+
You can set a single example for a property by utilizing the `example` key like this:
209+
210+
```typescript
211+
@ApiProperty({
212+
example: 'persian',
213+
})
214+
breed: string;
215+
```
216+
217+
If you want to give multiple examples, you can utilize the `examples` key by passing in an object structured like this:
218+
219+
```typescript
220+
@ApiProperty({
221+
examples: {
222+
Persian: { value: 'persian' },
223+
Tabby: { value: 'tabby' },
224+
Siamese: { value: 'siamese' },
225+
'Scottish Fold': { value: 'scottish_fold' },
226+
},
227+
})
228+
breed: string;
229+
```
230+
206231
#### Raw definitions
207232

208233
In some specific scenarios (e.g., deeply nested arrays, matrices), you may want to describe your type by hand.

0 commit comments

Comments
 (0)