committed by
GitHub
4 changed files with 8 additions and 1 deletions
@ -1,12 +1,15 @@ |
|||||
from typing import Optional |
from typing import Optional |
||||
|
|
||||
from fastapi import FastAPI |
from fastapi import FastAPI |
||||
from pydantic import BaseModel |
from pydantic import BaseModel |
||||
|
|
||||
app = FastAPI() |
app = FastAPI() |
||||
|
|
||||
|
|
||||
class Item(BaseModel): |
class Item(BaseModel): |
||||
description: Optional[str] |
description: Optional[str] |
||||
|
|
||||
|
|
||||
@app.post("/items/") |
@app.post("/items/") |
||||
async def create_item(item: Item): |
async def create_item(item: Item): |
||||
return item |
return item |
||||
|
|||||
Loading…
Reference in new issue