Operations — OpenAPI · NestJS

Describe each operation the way its callers experience it: a tag with a description, a summary, the header every route accepts, every response with its status and model, a global 500, a paginated response built with getSchemaPath, and a multipart upload body.

What you will learn

Read the theory for Operations

All OpenAPI lessons

All NestJS courses

loading types…

What you'll learn

  • Group operations with @ApiTags and describe the tag in the DocumentBuilder; add a summary with @ApiOperation and a shared header with @ApiHeader
  • Document responses with @ApiResponse and its status shorthands, with a model class as the type, and declare one response for every operation with addGlobalResponse
  • Describe a response the scanner cannot see, a generic page of results, with @ApiExtraModels, getSchemaPath and allOf, packaged as a reusable decorator with applyDecorators
  • Document a file upload as a multipart/form-data body with @ApiConsumes and a binary-string property