0
0
NestJSframework~10 mins

Swagger API documentation in NestJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Swagger module in a NestJS app.

NestJS
import { [1] } from '@nestjs/swagger';
Drag options to blanks, or click blank then click option'
AOpenApi
BSwaggerModule
CApiModule
DSwaggerDoc
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect import names like SwaggerDoc or ApiModule.
Forgetting to import from '@nestjs/swagger'.
2fill in blank
medium

Complete the code to create Swagger options with a title.

NestJS
const config = new DocumentBuilder().setTitle('[1]').build();
Drag options to blanks, or click blank then click option'
ANestJS API
BSwagger Docs
CAPI Documentation
DMy API
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the title empty or using non-string values.
Using confusing or unrelated titles.
3fill in blank
hard

Fix the error in the code to create Swagger document in main.ts.

NestJS
const document = [1].createDocument(app, config);
Drag options to blanks, or click blank then click option'
AOpenApi
BSwaggerDoc
CApiModule
DSwaggerModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong module names like SwaggerDoc or ApiModule.
Trying to call createDocument on the app instance.
4fill in blank
hard

Fill both blanks to setup Swagger UI in main.ts.

NestJS
SwaggerModule.[1](app, document, { swaggerOptions: { [2]: true } });
Drag options to blanks, or click blank then click option'
Asetup
Benable
CshowExplorer
Ddisplay
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like enable or display.
Confusing option names for Swagger UI.
5fill in blank
hard

Fill all three blanks to add a tag and description in Swagger DocumentBuilder.

NestJS
const config = new DocumentBuilder().setTitle('API').setDescription('[1]').addTag('[2]').setVersion('[3]').build();
Drag options to blanks, or click blank then click option'
AUser operations
Busers
C1.0
DAuthentication
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up description and tag values.
Using invalid version formats.