closeio / flask-mongorest

Restful API framework wrapped around MongoEngine
Other
523 stars 88 forks source link

Call `fetch_related_resources` for a single object, too. #130

Closed wojcikstefan closed 3 years ago

wojcikstefan commented 3 years ago

Even if we're only working with a single object, fetching its related resources in a custom way may still be useful (e.g. pre-fetching a subset of data for one of its reference fields).

This commit also makes it so that fetch_related_resources is called even if related_resources_hints is not specified on the resource. That's because subclasses can take advantage of this method (and when it's called) even if the original behavior (relying on related_resources_hints) does not matter.