DefinitionIntroductory
What does the '...' argument mean in Field(..., min_length=2)?
The '...' argument in Field(..., min_length=2) means that the field is required and there is no default value. In this context, it marks the 'name' field as mandatory, so validation fails if the field is omitted or empty.
Key points
- '...' signals that a value is required for that field.
- It indicates there is no default value assigned to the field.
- Validation will raise an error if the required value is missing or invalid.
Related questions
FastAPI: Modern Python Web Development
Bill Lubanovic;
First Edition · O'Reilly Media, Inc.