0

When I try to use the default docs in FastApi never works. If I use /docs it gives an error saying:

"Failed to load API definition. Error Hide Fetch Internal Server Error /openapi.json"

and if I use /redoc it loads forever and never appears anything. I searched a lot but the only thing I found out was someone using root_pah="/folder/" inside of the FastAPI() main instance, so I used the app folder which is the repository of the whole api project. I don't know if it will help you guys but the tree of the project is:

C:.
├───.pytest_cache
│   └───v
│       └───cache
├───alembic
├───app
│   ├───models
│   │   └───__pycache__
│   ├───routers
│   │   └───__pycache__
│   ├───tests
│   │   ├───.pytest_cache
│   │   │   └───v
│   │   │       └───cache
│   │   └───__pycache__
│   └───__pycache__
├───venv
│   ├───Include
│   │  
│   └───Scripts
└───__pycache__

p.s. I wiped most of the part of the venv directory because I thought that it was useless for this and also when I tried to copy and paste the whole output in here, Stack Overflow would accept just part of it because it was too big.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • router = APIRouter(prefix="/posts", tags=["Posts"]) @router.get("/") # response_model=List[schemas.Post]) def get_posts(limit: int = 10, skip: int = 0, search: Optional[str] = ""): if limit < 1: limit = 1 posts = Post.objects(type="post").aggregate( [ {"$limit": limit}, {"$skip": skip}, ] ) return list(posts) –  Jan 11 '22 at 21:08

0 Answers0