Bird
0
0

What is the main purpose of using @Schema() in NestJS?

easy📝 Conceptual Q11 of 15
NestJS - Database with Prisma
What is the main purpose of using @Schema() in NestJS?
ATo define the structure and rules of a data model
BTo create a new controller
CTo handle HTTP requests
DTo style components
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of @Schema()

    @Schema() is used to define how data should be structured and validated in NestJS models.
  2. Step 2: Compare with other options

    Creating controllers, handling HTTP requests, and styling components are unrelated to schema definition.
  3. Final Answer:

    To define the structure and rules of a data model -> Option A
  4. Quick Check:

    Schema decorator defines data structure [OK]
Quick Trick: Remember: @Schema() sets data shape, not controllers or styles [OK]
Common Mistakes:
  • Confusing @Schema() with controller decorators
  • Thinking @Schema() handles HTTP logic
  • Mixing schema with UI styling

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes