Results of 1 - 1 of about 1 for dataclass (0.000 sec.)
- Using Dataclasses 9414
- Using Dataclasses Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . FastAPI is built on top of Pydantic , and I have been showing you how to use Pydantic models to d
...eclare requests and responses. But FastAPI also supports using dataclasses the same way: Python 3.8+ from dataclasses import dataclass from typing import Union from fastapi import FastAPI @datacl...c def create_item ( item : Item ): return item This is still supported thanks to Pydantic , as it has internal support for dataclasses . So, even with the code above that doesn't use Pydantic explicitly, FastAPI is using Pydantic to convert those standard...dataclasses to Pydantic's own flavor of dataclasses. And of course, it supports the same: data validation data serialization data do... - https://man.mtool.work/fastapi/0.115/advanced/dataclasses/
PREV
1
NEXT