Skip to content

Commit

Permalink
AttributeError: 'FieldInfo' object has no attribute 'name'
Browse files Browse the repository at this point in the history
  • Loading branch information
pySatellite committed Nov 6, 2023
1 parent a9fd6ec commit 420101f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
15 changes: 14 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ name = "fcrud"
version = "0.2.0"
description = "fastapi-crudrouter + FastApi"
authors = [{ name = "pysatellite", email = "[email protected]" }]
dependencies = ["fastapi>=0.104.1", "uvicorn[standard]>=0.24.0.post1"]
dependencies = [
"fastapi>=0.104.1",
"uvicorn[standard]>=0.24.0.post1",
"fastapi-crudrouter>=0.8.6",
"pydantic>=2.4.2",
]
requires-python = ">=3.11"
readme = "README.md"
license = { text = "MIT" }
Expand Down
22 changes: 16 additions & 6 deletions src/fcrud/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

from fastapi import FastAPI

from pydantic import BaseModel
from fastapi_crudrouter import MemoryCRUDRouter as CRUDRouter

class Potato(BaseModel):
id: int
name: str
color: str
mass: float

app = FastAPI()
app.include_router(CRUDRouter(schema=Potato))


@app.get("/")
def read_root():
return {"Hello": "World"}
# @app.get("/")
# def read_root():
# return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] = None):
return {"item_id": item_id, "q": q}
# @app.get("/items/{item_id}")
# def read_item(item_id: int, q: Union[str, None] = None):
# return {"item_id": item_id, "q": q}

0 comments on commit 420101f

Please sign in to comment.