Bird
0
0

Which of the following is the correct way to add a description to a method parameter using @Parameter?

easy📝 Syntax Q12 of 15
Spring Boot - API Documentation
Which of the following is the correct way to add a description to a method parameter using @Parameter?
A@Parameter(value = "User ID") String userId
B@Parameter(description = "User ID") String userId
C@Parameter(desc = "User ID") String userId
D@Parameter(text = "User ID") String userId
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct attribute name

    The @Parameter annotation uses the attribute description to add text about the parameter.
  2. Step 2: Verify syntax correctness

    Only @Parameter(description = "User ID") String userId uses description correctly; others use invalid attribute names.
  3. Final Answer:

    @Parameter(description = "User ID") String userId -> Option B
  4. Quick Check:

    @Parameter uses description attribute = A [OK]
Quick Trick: Use description= for @Parameter text, not value or desc [OK]
Common Mistakes:
  • Using 'value' instead of 'description' attribute
  • Using non-existent attributes like 'desc' or 'text'
  • Omitting the attribute name entirely

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes