Complete the code to import the correct class for field validation in FastAPI.
from pydantic import [1]
The Field class is used to add validation rules to model fields in FastAPI.
Complete the code to set a minimum length validation for a string field.
name: str = Field(..., min_length=[1])Setting min_length=1 ensures the string must have at least one character.
Fix the error in the code by choosing the correct parameter to enforce a maximum value for an integer field.
age: int = Field(..., [1]=120)
In Pydantic, le means 'less than or equal to' and is used to set a maximum value.
Fill both blanks to add a regex pattern and a default value to a string field.
email: str = Field(default=[1], regex=[2])
The default email is set to "default@example.com" and the regex ensures a simple email format.
Fill all three blanks to create a field with a title, description, and example value.
username: str = Field([1], title=[2], example=[3])
The field has a default value "guest", a title "User Name", and an example "guest123" to help API users.