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

TypeError: get_body_field() got an unexpected keyword argument 'dependant' (FastAPI >=0.112.4) #1273

Closed
espdev opened this issue Sep 5, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@espdev
Copy link

espdev commented Sep 5, 2024

Hello!

I just update FastAPI version from 0.112.2 to 0.112.4 and fastapi-pagination is broken.

Traceback (most recent call last):
...
  File ".../python3.11/site-packages/fastapi_pagination/api.py", line 390, in add_pagination
    _add_pagination(parent)
  File ".../python3.11/site-packages/fastapi_pagination/api.py", line 380, in _add_pagination
    _update_route(route)
  File ".../python3.11/site-packages/fastapi_pagination/api.py", line 364, in _update_route
    route.body_field = get_body_field(dependant=route.dependant, name=route.unique_id)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: get_body_field() got an unexpected keyword argument 'dependant'

I don't know what happened, but it certainly doesn't follow the semver rules. Either FastAPI broke the public API in the patch version, or fastapi-pagination uses a private API.

@espdev
Copy link
Author

espdev commented Sep 5, 2024

Sorry, it seems this is a duplicate of: #1272

@espdev
Copy link
Author

espdev commented Sep 6, 2024

There is the PR that changes keyword-only argument from dependant to flat_dependant in fastapi.dependencies.utils.get_body_field public function:
fastapi/fastapi#12117

And these changes made it into the patch release 0.112.4. This broke semver convention, leading to this issue.

@m4rcelofs
Copy link

I don't know what happened, but it certainly doesn't follow the semver rules. Either FastAPI broke the public API in the patch version, or fastapi-pagination uses a private API.

At the risk of sounding pedantic - FastAPI is at 0.y.z, which semver considers "initial development", as in - no stable API yet and things may break at any time

@espdev
Copy link
Author

espdev commented Sep 6, 2024

@m4rcelofs we use the following dependency specification for FastAPI:

fastapi = '^0.112.0'

This means that the poetry update function will not update y version for 0.y.z dependency, only z will be updated.
So we expect that bumping PATCH version (z) will not break backwards compatibility for 0.y.z dependencies anyway.

@uriyyo uriyyo self-assigned this Sep 8, 2024
@uriyyo uriyyo added the bug Something isn't working label Sep 8, 2024
@uriyyo
Copy link
Owner

uriyyo commented Sep 10, 2024

Hi all,

New version 0.12.27 has been released, this issue should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants