You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to use a field from a @Group struct in methods like .field(), .all(), etc fails with an error like Instance 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:
finalclassPet:Fields{// The pet's name.@Field(key:"name")varname:String// The type of pet.@Field(key:"type")vartype:String// Creates a new, empty Pet.init(){}}finalclassUser:Model{staticvarschema:String="users"@ID(key:.id)varid:UUID?// The user's nested pet.@Group(key:"pet")varpet:Pet}
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
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
The text was updated successfully, but these errors were encountered: