Bird
0
0

Consider this model property annotated with @Schema:

medium📝 component behavior Q5 of 15
Spring Boot - API Documentation
Consider this model property annotated with @Schema:
@Schema(description = "User's age", minimum = "0", maximum = "120")
private int age;

What will this annotation do in the generated API documentation?
AShow the age field with description and allowed range 0 to 120
BEnforce age validation automatically at runtime
CIgnore the age field in the API documentation
DSet the default age value to 0
Step-by-Step Solution
Solution:
  1. Step 1: Understand @Schema attributes

    The description, minimum, and maximum attributes add metadata to the API docs showing the field's meaning and valid range.
  2. Step 2: Clarify runtime behavior

    @Schema does not enforce validation at runtime; it only documents constraints for API consumers.
  3. Final Answer:

    Show the age field with description and allowed range 0 to 120 -> Option A
  4. Quick Check:

    @Schema documents field details, not runtime validation [OK]
Quick Trick: Use minimum and maximum in @Schema to document value ranges [OK]
Common Mistakes:
  • Assuming @Schema enforces validation
  • Thinking it hides the field
  • Confusing default value with minimum

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes