[Feature Request] REST API Handler: Optional relationship ids in response
Our project uses the REST API handler. It worked well until recently when we noticed our requests loading slow. The reason was that every response always includes all relationship ids. This creates huge load on the database especially for models with a lot of relationships. Now that our project data has grow we really notice that. In almost all cases we do not really care for these ids so not loading them in the first place will be a huge improvement.
The problem could be solved by a parameter which can be set to disable the inclusion of the relationships ids. In this case only the relationship links would be included in the response. I tested it quickly by commenting out the following line in the REST API handler:
// include IDs of relation fields so that they can be serialized
this.includeRelationshipIds(type, args, 'include');
It would be really nice if you could wrap this line into an if statement based on a url parameter. Since I do not have a Zenstack development environment set up I think it would be easier if someone with Zenstack dev experience could help me implement this feature.
Thanks and regards
Hi @zupamario , thanks for filing this. I think it makes sense to add it as an option to the RESTAPIHandler. Would you be interested in making a PR? I'll be happy to facilitate.
Hi ymc9, Thanks for your response. Yes I'll try to create a PR for this.