Replies: 3 comments 11 replies
-
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(objectId, forKey: .objectId)
try container.encodeIfPresent(createdAt, forKey: .createdAt)
try container.encodeIfPresent(updatedAt, forKey: .updatedAt)
try container.encodeIfPresent(ACL, forKey: .ACL)
try container.encodeIfPresent(name, forKey: .name)
print("ENCODE TEST - name:", name ?? "nil")
}
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understand the context of your problem, maybe parse-community/parse-server#8646 and the |
Beta Was this translation helpful? Give feedback.
-
so basically I've been just been returning Response objects instead of ParseHookResponse objects to get all of the json data to send out to my client side instead of just getting Pointer objects if I use ParseHookResponse. What am I losing out on by doing that? What advantages does ParseHookResponse give over normal json Response object? What I'm doing now is wrapping the ParseHookResponse in a custom func that converts it into a Response object func makeHookJSONResponse<T: Encodable>(_ hookResponse: ParseHookResponse<T>) throws -> Response {
let encoder = User.getJSONEncoder()
let data = try encoder.encode(hookResponse)
var buffer = ByteBufferAllocator().buffer(capacity: data.count)
buffer.writeBytes(data)
let response = Response(status: .ok)
response.headers.add(name: .contentType, value: "application/json")
response.body = .init(buffer: buffer)
return response
} then that get's sent out down the line. so instead of returning ParseHookResponse objects, I return a Response object. let hookResponse = ParseHookResponse(success: testObject)
return try makeHookJSONResponse(hookResponse) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Was there a change in the last update of the server that only sends out the objectId of the object instead of the whole object?
my previous xcode tests where I received the whole object now only returns the objectId of the object and everything else is nil.
I'm trying to figure out if I made a mistake somewhere when I was working with Codable but seems like all my structs are affected.
Am I now only receiving a Pointer to the object I need even though I did all the preprocessing server side?
sample CloudCode result dump.
from what I gather, the server is only spitting out Pointers at this from ParseHookResponse even if I feed it a whole object.
Beta Was this translation helpful? Give feedback.
All reactions