googleapis / googleapis/google-cloud-go

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.

Open
#6,330 0 comments 0 reactions 1 assignee Assigned to @bhshkh View on GitHub
api: firestore next major: breaking change type: feature request
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

**Client**

firestore Go SDK

**Environment**

all

**Go Environment**

all

**Code**

e.g.
```go
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.