We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have two parent / child tables, and the parent table has custom primary key:
type Book @model @auth(rules: [{ allow: private, ownerField: "pOwner" }]) { id: ID! @primaryKey(sortKeyFields: ["title", "description"]) title: String! description: String! writers: [Writer] @hasMany(indexName: "byBook", fields: ["id"]) pOwner: String! } type Writer @model { id: ID! fname: String! lname: String! bookID: ID! @index(name: "byBook", sortKeyFields: ["id"]) book: Book! @belongsTo(fields: ["bookID"]) pOwner: String! }
When I add the same @auth to the child, I get the following error on attempt to generate the model with 'amplify codegen models':
InvalidDirectiveError: Invalid @belongsTo on Writer:book. Provided fields do not match the size of primary key(s) for Book
Below are the models that cause this error:
type Book @model @auth(rules: [{ allow: private, ownerField: "pOwner" }]) { id: ID! @primaryKey(sortKeyFields: ["title", "description"]) title: String! description: String! writers: [Writer] @hasMany(indexName: "byBook", fields: ["id"]) pOwner: String! } type Writer @model @auth(rules: [{ allow: private, ownerField: "pOwner" }]) { id: ID! fname: String! lname: String! bookID: ID! @index(name: "byBook", sortKeyFields: ["id"]) book: Book! @belongsTo(fields: ["bookID"]) pOwner: String! }
No response
3.13.5
1.5.0
Amplify CLI
The text was updated successfully, but these errors were encountered:
Hello @stephenjen - I was able to reproduce this issue. I am going to transfer this issue to our code gen repo.
Sorry, something went wrong.
@Jordan-Nelson Thanks for pushing this forward
No branches or pull requests
Description
I have two parent / child tables, and the parent table has custom primary key:
When I add the same @auth to the child, I get the following error on attempt to generate the model with 'amplify codegen models':
InvalidDirectiveError: Invalid @belongsTo on Writer:book. Provided fields do not match the size of primary key(s) for Book
Below are the models that cause this error:
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Flutter Version
3.13.5
Amplify Flutter Version
1.5.0
Deployment Method
Amplify CLI
Schema
No response
The text was updated successfully, but these errors were encountered: