aws-amplify / aws-amplify/amplify-android

Support custom mutations

Open
#2,777 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

Java, Kotlin, Kotlin - Coroutines

### Amplify Categories

GraphQL API

### Gradle script dependencies

```groovy
// Put output below this line
aws-api = { module = "com.amplifyframework:aws-api", version.ref = "awsApi" }
core = { module = "com.amplifyframework:core", version.ref = "awsApi" }
awsApi = "2.14.11"

```

### Environment information

```
# Put output below this line
------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------

Build time: 2023-10-04 20:52:13 UTC
Revision: e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f

Kotlin: 1.9.10
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 11.0.22 (Oracle Corporation 11.0.22+9-LTS-219)
OS: Windows 11 10.0 amd64

```

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

_No response_

### Describe the feature request

Add the ability to run custom mutation either by autogenerating from schema or building using a graphQL string.
For example, for the mutation defined in JS as follows:
```
Impression: a.model({
videoId: a.string().required(),
impressions: a.integer().default(0)
}).identifier(['videoId'])
.authorization([
a.allow.public().to(['read'])
]),

increaseImpression: a
.mutation()
// arguments that this query accepts
.arguments({
videoId: a.string()
})
// return type of the query
.returns(a.ref('Impression'))
// only allow signed-in users to call this API
.authorization([a.allow.public()])
.handler(a.handler.custom({
dataSource: a.ref('Impression'),
entry: './increment-impression.js'
}))
```
GraphQL Mutation:
```
mutation MyMutation {
increaseImpression(videoId: "1") {
impressions
}
}
```

### Initialization steps (if applicable)

_No response_

### Code Snippet

```java
// Put your code 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

The issue names no implementation files, tests, or entry points. Begin by locating the Android GraphQL API mutation surface and how generated operations are handled. Done means supporting custom mutations defined from a schema or a GraphQL string, with coverage for the requested mutation shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, graphql, java, kotlin
Domain
api, backend-api-design, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.