Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with latest version fastapi (0.100.1) #21

Open
arbakker opened this issue Aug 3, 2023 · 1 comment · May be fixed by rem13/fastapi-rfc7807#1
Open

does not work with latest version fastapi (0.100.1) #21

arbakker opened this issue Aug 3, 2023 · 1 comment · May be fixed by rem13/fastapi-rfc7807#1

Comments

@arbakker
Copy link

arbakker commented Aug 3, 2023

When running the following example code:

from fastapi import FastAPI
from fastapi_rfc7807 import middleware
import uvicorn

app = FastAPI()
middleware.register(app)

@app.get('/error')
async def error():
    raise ValueError('something went wrong')


def main():
    uvicorn.run(
        "coordinates_transformation_api.main:app", workers=2, port=8080, host="0.0.0.0"
    )

if __name__ == "__main__":
    main()

With the following versions and Python v3.11.4:

fastapi==0.100.1
fastapi-rfc7807==0.5.0
uvicorn==0.23.2

With:

python main.py

The application fails with the following message:

ImportError: cannot import name 'get_model_definitions' from 'fastapi.openapi.utils' (/home/anton/.local/lib/python3.11/site-packages/fastapi/openapi/utils.py)

Error is caused by FastAPI that recently switched to Pydantic v2. See the commit here.

I created this issue mainly to document the issue, and to perhaps revisit later myself (considering the lack of activity in the project).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants