유효성

FrameWork/Fastapi

[Fastapi] 경로 매개 변수에서의 유효성 검증

경로 매개 변수에서의 유효성 검증 경로 매개 변수에서 유효성을 검증하려고 한다면 Path을 이용하여 처리 할 수 있다. Path는 fastapi 패키지에 있기 때문에 import 해서 사용한다. from typing import Union from fastapi import FastAPI, Path, Query app = FastAPI() @app.get("/items/{item_id}") async def read_items( item_id: int = Path(title="The ID of the item to get"), q: Union[str, None] = Query(default=None, alias="item-query"), ): results = {"item_id": item_id} if ..

JHeaon
'유효성' 태그의 글 목록