new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

FastAPI · Tutorial · all subjects

extra-data-types

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

UUID data type in FastAPI

FastAPI supports the UUID data type for use in path and query parameters. A UUID (Universally Unique Identifier) is a standard identifier common in databases and systems. In requests and responses, a UUID is represented as a string.

datetime.time data type in FastAPI

FastAPI supports Python datetime.time objects in path and query parameters. In requests and responses, datetime.time is represented as a string in ISO 8601 format, such as 14:23:55.003.

datetime.timedelta data type in FastAPI

FastAPI supports Python datetime.timedelta objects in path and query parameters. In requests and responses, datetime.timedelta is represented as a float of total seconds. Pydantic also allows representing it as ISO 8601 time diff encoding.

frozenset data type in FastAPI

FastAPI supports frozenset, which is treated the same as set in requests and responses. In requests, a list is read, duplicates are eliminated, and it is converted to a set. In responses, the set is converted to a list. The generated schema specifies that the set values are unique using JSON Schema's uniqueItems.

bytes data type in FastAPI

FastAPI supports Python bytes data type. In requests and responses, bytes are treated as a string. The generated schema specifies that it is a string with binary format.

Decimal data type in FastAPI

FastAPI supports Python Decimal from the decimal module. In requests and responses, Decimal is handled the same as a float.

Features available with extra data types

When using extra data types in FastAPI, all standard features are available: great editor support, automatic data conversion from incoming requests, automatic data conversion for response data, data validation, and automatic annotation and documentation.

Natural Python type operations on parameters

When FastAPI parameters use their natural Python data types (such as datetime.date), you can perform normal operations on them within the function, such as date manipulations, without needing type conversion.

Give your agent this brain