Pointer.fetch(includeKeys:....) doesn't include keys? #128
Replies: 3 comments 3 replies
-
Nice find! It looks like it was missed. Can you open a pull request with the fix? The code you highlighted needs “params” like Parse-Swift/Sources/ParseSwift/API/API+Command.swift Lines 496 to 504 in 5f2c5f4 can you also add test cases here https://github.com/netreconlab/Parse-Swift/blob/main/Tests/ParseSwiftTests/ParsePointerTests.swift |
Beta Was this translation helpful? Give feedback.
-
I've adjusted the code to account for it! |
Beta Was this translation helpful? Give feedback.
-
Am struggling a little with the tests. I can't add a property such as: struct GameScore: ParseObject {
//: These are required by ParseObject
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
//: Your own properties
var points: Int
var other: Pointer<GameScore>?
var others: [Pointer<GameScore>]?
var score: GameScore? <------NEW
//: a custom initializer
init() {
self.points = 5
}
init(points: Int) {
self.points = points
}
} as this gives the error But I also couldn't create a new struct like: struct GameScore: ParseObject {
//: These are required by ParseObject
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
//: Your own properties
var points: Int
var other: Pointer<GameScore>?
var others: [Pointer<GameScore>]?
var game: Game?
//: a custom initializer
init() {
self.points = 5
}
init(points: Int) {
self.points = points
}
}
struct Game: ParseObject {
//: These are required by ParseObject
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
//: Your own properties
var points: Int
//: a custom initializer
init() {
self.points = 5
}
init(points: Int) {
self.points = points
}
} as I get an error of testIncludeKeysFetch(): failed - Should encode/decode. Error keyNotFound(CodingKeys(stringValue: "points", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "game", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: \"points\", intValue: nil) (\"points\").", underlyingError: nil)) I was trying to follow the same methodology as |
Beta Was this translation helpful? Give feedback.
-
Just wanted to check whether the below function is working as intended.
It looks like the parameter includeKeys is not actually being used in the function, and so isn't fetching the contents of any nested objects.
For example's sake, I have the following structs:
So I should be able to do the following:
but unfortunately it shows up as
nil
If I forcefully fetch (i.e.
meta.school?.fetch()
), it correctly prints out the school name.Beta Was this translation helpful? Give feedback.
All reactions