I have a vapor route that return an EventLoopFuture of my type. This type has an @OptionalParent, which points to another Model. When the data comes back and this field is nil the returned json of the client caller has an empty "shell" object in place of the nil OptionalParent. Is there no way of just not returning anything for this parent when it is nil? This is my query.
Comment
.query(on: req.db)
.with(\.$owner)
.with(\.$parentComment) { parentComment in
parentComment.with(\.$owner)
}
.all()