# Field Rules: Lengths, Ranges and Choices

Field() puts rules on a model's fields, such as a name of 1 to 80 characters and an age of 18 or over, Literal allows only a fixed set of values, EmailStr checks the shape of an email address, and Query puts the same kind of rules on a query parameter.

![Cheat sheet: Field Rules: Lengths, Ranges and Choices](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/0cc4a94beeee47f393d302b2daaeaa5f.webp)

- Category: FastAPI
- Level: Journeyman
- Tags: Annotated, EmailStr, fastapi, Field Validation, Literal Type (python), python, Query Parameter (fastapi)
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/fastapi-pydantic-field-rules-cheat-sheet
