-
Notifications
You must be signed in to change notification settings - Fork 144
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
How to use pydantic model on UseAdditionalFields ? #1452
Comments
@uriyyo, any suggestions? I’m happy to contribute to this. |
@Kavan72 But it's kinda required to use, otherwise you will use default Page class. Is there any reason why you don't want to use There is also |
Actually, I don’t like monkey patching, which is why I’m avoiding this. I also have my own OpenAPI build function, and I don’t want any library modifying my OpenAPI schema. While pagination_ctx is fine, it’s not an ideal solution. You mentioned that I’m Depends on this, but that’s not accurate. A custom page is a response class, not something that relies on a dependency. |
Sorry, I guess my message was not clear. When you call
You can see it here: fastapi-pagination/fastapi_pagination/api.py Lines 135 to 136 in f867c15
|
Hey @uriyyo, I understand what you’re trying to say. My idea is that if someone comes from a different framework or language, using |
@uriyyo hey any update 😅, if you are okay then I’m happy to contribute to this. |
Discussed in #1451
Originally posted by Kavan72 January 29, 2025
I've my pydantic model and i want to use on UseAdditionalFields, like this
My code for custom page
Since I’m not using
add_pagination(app)
, FastAPI Pagination can’t find my custom page class. Is there any way to pass the class into the paginate method so it can use my custom page? Sorry, but I don’t prefer usingadd_pagination
orset_page
.The text was updated successfully, but these errors were encountered: