0
0
Spring Bootframework~10 mins

@Parameter and @Schema annotations in Spring Boot - Interactive Code Practice

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

Complete the code to add a description to a method parameter using @Parameter annotation.

Spring Boot
@Parameter(description = "[1]")
public void getUser(String userId) {}
Drag options to blanks, or click blank then click option'
AUser identifier
BUser name
CUser age
DUser email
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated descriptions like 'User name' when the parameter is an ID.
Leaving the description empty.
2fill in blank
medium

Complete the code to specify the example value for a schema using @Schema annotation.

Spring Boot
@Schema(example = "[1]")
private String status;
Drag options to blanks, or click blank then click option'
Anull
B123
Ctrue
Dactive
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric or boolean values as examples for string fields.
Using 'null' as an example which is not informative.
3fill in blank
hard

Fix the error in the annotation to correctly mark a parameter as required using @Parameter.

Spring Boot
@Parameter(required = [1])
public void updateUser(String userId) {}
Drag options to blanks, or click blank then click option'
A"true"
Btrue
CTrue
DTRUE
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around true making it a string.
Using uppercase True or TRUE which are invalid.
4fill in blank
hard

Fill both blanks to define a schema with a description and a minimum value.

Spring Boot
@Schema(description = "[1]", minimum = "[2]")
private int age;
Drag options to blanks, or click blank then click option'
AUser age
B18
CMinimum age allowed
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric values without quotes for minimum.
Using unrelated descriptions.
5fill in blank
hard

Fill all three blanks to create a parameter annotation with a name, description, and required flag.

Spring Boot
@Parameter(name = "[1]", description = "[2]", required = [3])
public void deleteUser(String id) {}
Drag options to blanks, or click blank then click option'
AuserId
BThe ID of the user to delete
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using false for required when the parameter is mandatory.
Mismatching the name with the actual parameter variable.