You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to create a sample code from the documentation. However it throws a type error.
Please find my code and other details below.
Code:
from pydantic import BaseModel
from fastapi import FastAPI
from fastapi_crudrouter import MemoryCRUDRouter as CRUDRouter
class Car(BaseModel):
name: str
year: int
make: str
app = FastAPI()
app.include_router(CRUDRouter(schema=Car))
When I try to execute this, I get the following error.
Traceback (most recent call last):
File "/home/dineshkumarkb/MyGitHub/MyPractice/Python/fastapi/autogenerate.py", line 13, in <module>
app.include_router(CRUDRouter(Car))
File "/home/dineshkumarkb/.local/lib/python3.8/site-packages/fastapi_crudrouter/core/mem.py", line 11, in __init__
super(MemoryCRUDRouter, self).__init__(schema, *args, **kwargs)
File "/home/dineshkumarkb/.local/lib/python3.8/site-packages/fastapi_crudrouter/core/_base.py", line 35, in __init__
super().__init__(prefix=prefix, tags=[prefix.strip('/').capitalize()], *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'prefix'
Am I missing something?
Python version : 3.8.5
OS : Ubuntu 20.04
The text was updated successfully, but these errors were encountered:
Hi there thanks for the feedback! I tested this with fastapi version 0.62.0+ and it worked. It seems prefix was a new feature in v.0.62 so that likely your issue. What version were you using?
Hi there,
I tried to create a sample code from the documentation. However it throws a type error.
Please find my code and other details below.
Code:
When I try to execute this, I get the following error.
Am I missing something?
Python version : 3.8.5
OS : Ubuntu 20.04
The text was updated successfully, but these errors were encountered: