Bird
0
0

Consider this annotation usage:

medium📝 Debug Q6 of 15
Spring Boot - API Documentation
Consider this annotation usage:
@Operation(summary = "Get products", description = Get all products)

Why might the description not appear in the generated API docs?
AThe summary attribute must be omitted to show the description.
BThe description value is not enclosed in quotes, causing a syntax error.
CThe description attribute is deprecated and ignored.
DThe annotation requires an additional @ApiResponse annotation to show descriptions.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the description value

    The description value must be a string literal enclosed in quotes.
  2. Step 2: Identify the error

    Here, Get all products is not quoted, so it is treated as an identifier, causing the description to be ignored.
  3. Final Answer:

    The description value is not enclosed in quotes, causing a syntax error. -> Option B
  4. Quick Check:

    Always quote string values in annotations [OK]
Quick Trick: Always quote string literals in annotation attributes [OK]
Common Mistakes:
  • Forgetting quotes around string values
  • Assuming summary hides description
  • Believing description attribute is deprecated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes