aws-amplify / aws-amplify/docs
Can AppSync owner field be used as primary key?
- Dominant language
- MDX
- Stars
- 506
- Forks
- 1.1k
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 1
Description
The [GraphQL Per-user / owner-based data access](https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access) docs state the following:
> Do not set ownerField to your @primaryKey field or id field if no primary key is specified. If you want to query by the ownerField, use an @index on that ownerField to create a secondary index.
I'm seeking clarification around if/when it is appropriate to apply the @primaryKey directive to the owner field. My ultimate goal is to enforce a 1:1 constraint for a given Cognito user and GraphQL model.
Contributor guide
Research direction
Start with the linked GraphQL per-user/owner-based data access documentation, especially the guidance for ownerField, @primaryKey, and @index. Determine whether using the owner field as a primary key is supported for the stated 1:1 Cognito-user constraint, then update the documentation with the applicable clarification and examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, graphql
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100