aws-amplify / aws-amplify/amplify-android

syncExpression doesn't support lists

Open
#1,509 1 comment 0 reactions 0 assignees View on GitHub
datastore feature-request
Dominant language
Java
Stars
287
Forks
132
Avg merge
2d 2h
Merged PRs (30d)
45

Description

### Before opening, please confirm:

- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-android/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-android/discussions).

### Language and Async Model

Kotlin

### Amplify Categories

DataStore

### Gradle script dependencies

```groovy
// Put output below this line

```

### Environment information

```
# Put output below this line

```

### Please include any relevant guides or documentation you're referencing

https://docs.amplify.aws/lib/datastore/sync/q/platform/android/#selectively-syncing-a-subset-of-your-data

### Describe the bug

We are using group authorisation and as AppSync doesn't support dynamic group authorisation, and tells every device when something has been created/updated/deleted despite group settings, I tried to add in the following syncExpression:

.syncExpression(***::class.java) { ***.GROUP.contains("3bd49a54-cb68-454c-860e-d06d7dc1bd0f") }

GROUP being a list of strings, but on running the app the expression fails with:
java.lang.IllegalArgumentException: group field inside provided object cannot be evaluated by the operator type: CONTAINS

### Reproduction steps (if applicable)

Attempt to use a syncExpression for a QueryField that is a List<*>

### Code Snippet

```java
// Put your code below this line.

```

### Log output

```
// Put your logs below this line

```

### amplifyconfiguration.json

_No response_

### GraphQL Schema

```graphql
// Put your schema below this line

```

### Additional information and screenshots

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the selectively syncing guide linked in the issue and reproduce the failure using a syncExpression on a List field with CONTAINS. Trace where the expression is evaluated and identify the existing tests for sync expressions; done means list fields can be used with CONTAINS without the reported IllegalArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
databases, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.