Vincit / objection-graphql

GraphQL schema generator for objection.js
MIT License
307 stars 35 forks source link

select method of query not used -> how to extend query builder with objection-graphql #3

Closed Allam76 closed 7 years ago

Allam76 commented 7 years ago

This is a continuation of #264.

This issue is how to add a virtual field with materialized path. In vanilla objection, this can be done with an extended query builder and extended select method that adds an eager parent relation loading if the virtual field is requested. Then this data is picked up in the getter of the virtual field with a traverse call. This is a very elegant solution.

Now, objection-graphql does not seem to use the select method at all when doing a query, so then this solution above is not valid. Is there any other way and why should not only the requested fields from the graphql query be fetched?

Many thanks!

koskimas commented 7 years ago

The version in master branch now uses select. This will be fixed in the next release.

Allam76 commented 7 years ago

Super. Thank you!