@DocumentID when receiving data from source that isn't Firestore #11444
Alex-Coetzee
started this conversation in
General
Replies: 1 comment 2 replies
-
You will probably need to split the struct up into two separate types:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Lets say we have a Struct
In most cases I am querying Firestore directly making the @documentid property wrapper very useful.
However, when utilising the newer Functions API I sometimes receive data from the server, which of course does not include a Document ID
I have simplified the code example to make it easier to follow so let's assume I am sending the COdable as a Person and receiving a Person type back from the function, the issue is that encoding fails due to the @documentid wrapper.
let response = try await Functions.functions().httpsCallable("savePerson", requestAs: Person.self, responseAs: Person.self)
Is there a way to specificy to ignore the DocumentID wrapper in this scenario when receiving the data back from the server?
Is there a way to customise it using the coding keys or a custom decoder?
Please could you point me in the right direction as it would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions