aws-amplify / aws-amplify/amplify-data
Feature Request: Amplify Gen2 SelectionSet Support for CustomQueries
- Dominant language
- TypeScript
- Stars
- 18
- Forks
- 23
- Avg merge
- 26m
- Merged PRs (30d)
- 1
Description
### Is this related to a new or existing framework?
React Native
### Is this related to a new or existing API?
GraphQL API
### Is this related to another service?
DynamoDB - Amplify Gen 2
### Describe the feature you'd like to request
Right now there is no way to define the selection set that you want in your custom queries using amplify gen 2.
Refer to this thread with @chrisbonifacio:
https://github.com/aws-amplify/amplify-js/issues/13365
### Describe the solution you'd like
I would like to be able to define selection sets (e.g. deeper hasMany relationship objects) in custom queries.
### Describe alternatives you've considered
Right now I have to enter:
`
npx ampx generate graphql-client-code --out src/graphql
`
to generate graphQL code and define the deper objects in the output:
```graphql
query CheckBatchOfPhoneNumbersForActiveUsers($phoneNumbers: [String]) {
checkBatchOfPhoneNumbersForActiveUsers(phoneNumbers: $phoneNumbers) {
createdAt
phoneNumber
updatedAt
user {
birthdate
createdAt
firstName
id
lastName
profileImage
profileImageBlurhash
pushToken
searchTerm
updatedAt
username
__typename
}
userId
__typename
}
}
```
### Additional context
_No response_
### Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Research direction
Start by reviewing the linked issue thread and the generated output from `npx ampx generate graphql-client-code --out src/graphql`. Compare that output with how Amplify Gen 2 custom queries currently define selections, especially nested user objects. Done means custom queries can request deeper relationship selections without manually editing generated GraphQL code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, react-native, typescript
- Domain
- api, backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100