Performance: Remove duplicated information from /api/v3/comment/list
Requirements
- [X] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
- [X] Did you check to see if this issue already exists?
- [X] Is this only a feature request? Do not put multiple feature requests in one issue.
- [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Is your proposal related to a problem?
The endpoint returns a lot of duplicated information since each comment has "post" and "community" objects with the same information.
Example: compare of the JSON of two comments:
https://github.com/LemmyNet/lemmy/blob/0c82f4e66065b5772fede010a879d327135dbb1e/src/api_routes_http.rs#L232
https://github.com/LemmyNet/lemmy/blob/0c82f4e66065b5772fede010a879d327135dbb1e/crates/db_views/src/comment_view.rs#L121-L132
Describe the solution you'd like.
Remove the "post" and "community" objects from the comments when returned from the endpoint or in the database query. There may be users of the information that would need to be updated.
Describe alternatives you've considered.
Replace the full objects with ID's.
Additional context
No response
I brought up the idea of using a GraphQL API or a REST API that allows clients to specify the fields they want as other possible solutions for this issue in the dev matrix room. It could be worth considering since it would avoid needing to make multiple requests to fetch information for the related creator, post, etc. There are a couple of different ways to skin this cat.
#2862
I fully believe this is the only solution to the current API woes. The API is even currently designed as if it were expecting to be GraphQL
Same as https://github.com/LemmyNet/lemmy/issues/2957