반응형 백엔드1 Fast API 배우기 7부 - Field 클래스 Field 클래스란 쿼리 파라미터를 Query클래스로 다루고 패스 파라미터를 Path클래스로 다루고 리퀘스트 바디를 Body 클래스로 다루듯이 리퀘스트 바디 안에 있는 Metadata를 Feild 클래스로 세세하게 다룰 수 있다 from typing import Optional from fastapi import Body, FastAPI from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str description: Optional[str] = Field( None, title="The description of the item", max_length=300 ) price: float = Field(...,.. 2021. 11. 1. 이전 1 다음 반응형