Skip to content

Commit

Permalink
Fix LookupResponse so missing entities can be correctly decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain Hunt committed Aug 13, 2024
1 parent f5029fb commit d968ed7
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Core

public struct LookupResponse: GoogleCloudModel {
public init(deferred: [Key]? = nil, found: [EntityResult]? = nil, missing: [EntityResult]? = nil) {
public init(
deferred: [Key]? = nil,
found: [EntityResult]? = nil,
missing: [MissingEntityResult]? = nil
) {
self.deferred = deferred
self.found = found
self.missing = missing
Expand All @@ -11,5 +15,16 @@ public struct LookupResponse: GoogleCloudModel {
/// Entities found as ResultType.FULL entities. The order of results in this field is undefined and has no relation to the order of the keys in the input.
public let found: [EntityResult]?
/// Entities not found as ResultType.KEY_ONLY entities. The order of results in this field is undefined and has no relation to the order of the keys in the input.
public let missing: [EntityResult]?
public let missing: [MissingEntityResult]?
}

public struct MissingEntityResult: GoogleCloudModel {
/// A KEY_ONLY entity
public let entity: MissingEntity
/// the version of the snapshot that was used to look up the entity
public let version: String

public struct MissingEntity: GoogleCloudModel {
public let key: Key
}
}

0 comments on commit d968ed7

Please sign in to comment.