Support Pagination and Column Blacklist#2
Conversation
lockie
left a comment
There was a problem hiding this comment.
Thanks for your efforts! There's some minor naming issues, an extra debug print and a need to modify DBAPI2Resource as you did with SQLAlchemyResource. Otherwise it looks good to me.
|
Thank you for the indepth review. |
|
You're welcome! |
|
Does that fix the issue(s)? edit:// I changed limit and page to page[size] and page[number] respectfully to match JSON:API. I have modified the meta as that is where the limit stuff is supposed to go based on JSON:API. I also added a links sections based on JSON:API pagination information as well. Let me know if you want any other changes. I added an auth.py example as I don't think it is obvious to new users that authentication can be added to the API (and perhaps should be). I added a spec.py example which should help with the automatic documentation generation TODO you have. You can use sphinx-jsonschema to generate documentation. Anything else and I think this project would become very bloated. Should this be an official handle? edit2:// StructuralWalker was bugging out for me with relationships for SQLAlchemy so I now use NoForeignKeyWalker and support relationships when rendering. Creating or updating not currently tested |
|
Yeah, 964f725 fixes the limit/offset issue. |
|
Thanks again for your efforts! |
Used black for code formatting
For the sqla.py example you can try the following:
http://localhost:8888/api/posts/?limit=1
http://localhost:8888/api/posts/?limit=2&page=2
You'll see the server has a hard limit of 12 but you can request a smaller limit if desired.
Blacklisting is as simple as adding the column to the resource blacklist