Closed Jean-Daniel closed 2 weeks ago
I don't think this is supported behaviour. The @Group
is supposed to be all fetched so that we can populate it correctly. I'd say if you need to retrieve specific fields you should look at flattening the model
Tim is correct; the all()
method does not support deep keypaths - and while fixing it to do so would be simple, it would also require a source-breaking change and thus can't be done for Fluent 4.
Describe the issue
Trying to use a field from a
@Group
struct in methods like.field()
,.all()
, etc fails with an error likeInstance method 'all' requires the types 'User' and 'GroupPropertyPath<User, FieldProperty<Pet, String>>.Model' (aka 'Pet') be equivalent.
FluentKit version
1.49.0
Operating system and version
macOS 14.7
Swift version
Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Steps to reproduce
Create a Vapor project.
Define the following model:
Try to build a query using that model
Build the project.
Outcome
The build fails with the error:
Additional notes
No response