tezvyn:

What is the :path converter in FastAPI?

Source: fastapi.tiangolo.comadvanced

Tests FastAPI routing semantics and URL segmentation. A strong answer states :path captures slashes across segments while plain str stops at the next slash, and cites file-serving as the use case.

Tests deep knowledge of FastAPI/Starlette path parsing and the difference between type hints and path converters. A great answer covers four points: first, a standard str parameter only matches characters between slashes because routers segment URLs on /; second, the :path converter greedily matches the remainder of the URL including slashes; third, it is required for nested file paths like docs/tutorial.md; fourth, it is a Starlette converter, not a Pydantic type. Red flag: claiming str accepts slashes or confusing :path with validation.

Read the original → fastapi.tiangolo.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

What is the :path converter in FastAPI? · Tezvyn