@key on field annotated with @connection
See original GitHub issue** Which Category is your question related to? ** GraphQL Schema
** What AWS Services are you utilizing? ** API, AppSync
** Provide additional details e.g. code snippets **
The below produces this expected error on amplify push
:
Expected scalar and got User
type Membership @model @key(fields: ["user"], name: "ByUser", queryField: "membershipsByUser") {
id: ID!
channel: Channel @connection(name: "channelMemberships")
user: User @connection(name: "userMemberships")
}
Can we create a gsi on a connection field? Ultimately it’s represented by the id.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Key annotations you need to know when working with JPA ...
JPA and Hibernate require you to specify at least one primary key attribute for each entity. You can do that by annotating an...
Read more >java - How can I mark a foreign key constraint using Hibernate ...
I am trying to use Hibernate annotation for writing ...
Read more >Code First Data Annotations - EF6 | Microsoft Learn
Code First Data Annotations in Entity Framework 6. ... This property will map to a primary key column in the database.
Read more >The Key Attribute - Learn Entity Framework Core
The Key attribute is used to denote the property that uniquely identifies an entity (the EntityKey ), and which is mapped to the...
Read more >Defining data using Room entities - Android Developers
You define each Room entity as a class that is annotated with @Entity . A Room entity includes fields for each column in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
oh wow sorry guys just saw this @davidbiller @amirmishani If I remember correctly I wanted to be able to query the table with the non key field which was a @connection field. No point to create a gsi around, since @connection I believe creates a gsi under the hood. So You really just need to go to the table being referenced. In my case for example, table
User
hasmemberships
and if I say user.memberships, that will give me all the user memberships I need. That’s technically a query using a gsi in the membership table.So long story short, don’t use a @key on @connection.
Here 😃 so how did you fix this? i need to use @key, but than i need a connection for a field inside