fastapi-pagination icon indicating copy to clipboard operation
fastapi-pagination copied to clipboard

[NEED HELP] 📃 Update docs

Open uriyyo opened this issue 3 years ago • 17 comments

Documentation should be updated.

Topics that should be covered:

  • [x] General information
  • [x] Customization
  • [x] Features
  • [x] Integrations
  • [ ] Examples
  • [ ] sqlachemy extension details

Missed features docs:

  • [ ] Additional data
  • [ ] Items transformers

Related issue: #273 #269 #264

Library has bad documentation and I am not good at documentation writing. It will be great if somebody can help to improve documentation.

uriyyo avatar Jan 08 '22 21:01 uriyyo

Hello. Is this for the case where you want to do perform get request that returns list of data so you cut the data in certain size and return to the user? like.. the pagination in API request?

JaeungJayJang avatar Mar 11 '22 04:03 JaeungJayJang

I was considering using this lib. Since it really lacks documentation, I can't make the decision. I'm not sure if it'd have a really big impact on my project. I'm using APIRouter for registering my endpoints and I couldn't see any example using that, just FastAPI.

I think I'll wait until there is more documentation in place.

letoss avatar Sep 01 '22 09:09 letoss

Hey @uriyyo, What topics are you hoping to broaden the docs on? I don't have a ton of time, but I take detailed notes when I work with new packages, so may be able to send some writing your way from time to time.

HDM007 avatar Apr 19 '23 06:04 HDM007

@HDM007 Thanks for your help. I hope to cover:

  • items transformer
  • additional data
  • more customization examples
  • sqlaclhemy extension docs with generated SQL examples

uriyyo avatar Apr 20 '23 08:04 uriyyo

Sure thing! I've already begun using the items transformer, so I can tackle that in my free time.

The way I understand it, the items transformer allows us to pass a function to format the paginated response; e.g.

  • if I retrieve a SQLAlchemy object from the db which doesn't immediately adapt to a Pydantic Schema, I can use paginate to apply complex PydanticSchemas to a collection
  • if I want to retrieve price rates on an item and modify them per region, I could use a transformer to look at row, apply a rate multiplier to the price, and return a transformed item with updated prices based on the original rate.

I will go deeper into the package to understand more about the Transformer. Are there any critical details you'd like to point out/focus on?

HDM007 avatar Apr 20 '23 22:04 HDM007

I guess it will be enough just to add usage examples with minimal implementation details so users will know how to use this feature.

uriyyo avatar Apr 21 '23 09:04 uriyyo

strangly this will work: async def get_conversations_by_session(*, session: Session = Depends(get_session), session_id: str) -> Page[LogEntryResponseDTO]:

but the version in the version in the Readme.md

async def get_conversations_by_session(*, session: Session = Depends(get_session), session_id: str, response_model=Page[LogEntryResponseDTO]):

I could fix it by defining the response_type as above, but maybe someone should fix the docs here.

leosok avatar Feb 21 '24 12:02 leosok

@leosok Both definitions are correct in terms of FastAPI.

This feature was added in FastAPI version 0.89.0 and README was written long-long time ago)

async def get_conversations_by_session(*, session: Session = Depends(get_session), session_id: str) -> Page[LogEntryResponseDTO]:
    ...

Thanks for pointing it, I will update README.md.

uriyyo avatar Feb 21 '24 14:02 uriyyo

@uriyyo Really love this package, great work! I also (strangely) love writing technical documentation.

Personally, I've found the docs to be sufficient for my current usage of the tool, but would love to help fill in the gaps as needed. I saw that the three related issues you tagged in this were all closed.

Is there another section of the codebase you think could benefit from additional documentation?

widal001 avatar Feb 23 '24 22:02 widal001

@widal001 I would love it if you could help me with documentation.

I feel like there is a lot of functionality that is not covered in the documentation.

For instance, here is the functionality from https://github.com/uriyyo/fastapi-pagination/blob/main/fastapi_pagination/api.py that is not covered at all:

  • resolve_params
  • create_page
  • set_params
  • set_page
  • set_items_transformer
  • pagination_ctx

These are the first things that come to my mind, I am sure that there is more to cover. It will be also great to improve existing docs.

uriyyo avatar Feb 24 '24 11:02 uriyyo

@uriyyo Thanks for flagging these items!

I'll take a closer look at that section of the code base, create the corresponding ticket(s), link them here for awareness, and aim to open up a PR in the next 1-2 weeks.

widal001 avatar Feb 25 '24 19:02 widal001

I've been using the repo for my work involving PyMongo. I can help with some PyMongo examples similar to the code snippet shown for SQLAlchemy in the docs.

Lord-V15 avatar Mar 04 '24 18:03 Lord-V15

@Lord-V15 It will be really great, cause I'm not working with Mongo at all(

uriyyo avatar Mar 04 '24 18:03 uriyyo

@widal001 @Lord-V15 Hi guys!

Are you still interested in docs improving?)

uriyyo avatar Apr 18 '24 12:04 uriyyo

@widal001 @Lord-V15 Hi guys!

Are you still interested in docs improving?)

Yes ! I will add some PyMongo examples for sure. Completely forgot about it my bad. Should I follow the format of the SqlAlchemy example ?

Lord-V15 avatar Apr 28 '24 23:04 Lord-V15

Yup, please follow sqlachemy example. You can add as much info as you want. Thanks for your help 🙏

uriyyo avatar Apr 29 '24 18:04 uriyyo

Hey @uriyyo I just created #1147 to track my work on the sections of the documentation you suggested

widal001 avatar Apr 30 '24 19:04 widal001