Skip to content

Commit a80f358

Browse files
Merge pull request #2743 from Kuki145/reusable-openapi-decorators
docs(openapi) fix reusable custom decorator explanation
2 parents 8f24216 + 59f30f5 commit a80f358

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

content/openapi/operations.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export const ApiPaginatedResponse = <TModel extends Type<any>>(
258258
model: TModel,
259259
) => {
260260
return applyDecorators(
261+
ApiExtraModels(model),
261262
ApiOkResponse({
262263
schema: {
263264
allOf: [
@@ -279,6 +280,8 @@ export const ApiPaginatedResponse = <TModel extends Type<any>>(
279280

280281
> info **Hint** `Type<any>` interface and `applyDecorators` function are imported from the `@nestjs/common` package.
281282
283+
To ensure that `SwaggerModule` will generate a definition for our model, we must add it as an extra model, like we did earlier with the `PaginatedDto` in the controller.
284+
282285
With this in place, we can use the custom `@ApiPaginatedResponse()` decorator on our endpoint:
283286

284287
```ts

0 commit comments

Comments
 (0)