google-cloud-go
google-cloud-go copied to clipboard
firestore: query array-type-filter `in`, `array-contains-any` and `not-in` should return an error when passed a value that is not of array type.
Client
firestore Go SDK
Environment
all
Go Environment
all
Code
e.g.
q.Where("x", "in", 1),
q.Where("x", "in", nil),
q.Where("x", "in", []int(nil)),
q.Where("x", "not-in", []int(nil)),
q.Where("x", "array-contains-any", []int(nil))
Expected behavior
An error is returned alerting the developers that "in/not-in/array-contains-any requires an Array value".
Actual behavior
No error is returned and the invalid API message is constructed (note the server should already be rejecting this request. Implementing this in the SDK serves as a defense in depth mechanism. it is the same reason that other client-side validation is done)
Additional context
More context in this https://github.com/googleapis/google-cloud-go/pull/6133