Skip to content

Commit

Permalink
materialize-webhook: require collection keys in field selection
Browse files Browse the repository at this point in the history
Previously, collection keys (and all other fields) were forbidden from
field selection. Since the runtime uses field selection to determine the
composite keys that are sent into Load & are reduced then sent as Store
requests, only a small subset of the full collection was being sent to
the connector. This resulted in data loss.

Adding this case statement helps prevent this unintentional document
reduction from happening.
  • Loading branch information
Alex-Bair committed Nov 8, 2024
1 parent f99ee99 commit 8ecff11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions materialize-webhook/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func (driver) Validate(ctx context.Context, req *pm.Request_Validate) (*pm.Respo
case projection.IsRootDocumentProjection():
constraint.Type = pm.Response_Validated_Constraint_LOCATION_REQUIRED
constraint.Reason = "The root document must be materialized"
case projection.IsPrimaryKey:
constraint.Type = pm.Response_Validated_Constraint_LOCATION_REQUIRED
constraint.Reason = "Document keys must be included"
default:
constraint.Type = pm.Response_Validated_Constraint_FIELD_FORBIDDEN
constraint.Reason = "Webhooks only materialize the full document"
Expand Down

0 comments on commit 8ecff11

Please sign in to comment.