You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the contacts+schema.swift file generated by CLI command "Amplify codegen models".
There was a prior issue opened related to this -> #2460
and was tracked and partially resolved the "pluralName deprecation" by issue -> #3135. However, the "id" deprecation issue doesn't seem to be resolved.
I tried to set the "respectprimarykeyattributesonconnectionfield" flag in the cli.json file to true and run "Amplify push" and then "Amplify codegen models". but i got the same "'id' is deprecated: Use .primaryKey(fields:)" warning.
I also tried to manually change the "contacts+schema.swift" file, by changing ".id()" to ".primaryKey(fields:)" as the warning suggests. however, i got different errors instead.
Steps To Reproduce
Steps to reproduce the behavior:1. define "contacts" model asbelow
import Amplify
import Foundation
publicstructContacts:Model{publicletid:StringpublicvarcontactId:StringpublicvarcontactName:StringpublicvarcontactProfileImageKey:StringpublicvaruserProfileContactsId:String?publicinit(id:String=UUID().uuidString,
contactId:String,
contactName:String,
contactProfileImageKey:String,
userProfileContactsId:String?=nil){self.id = id
self.contactId = contactId
self.contactName = contactName
self.contactProfileImageKey = contactProfileImageKey
self.userProfileContactsId = userProfileContactsId
}}2. run cli command "amplify codegen models" to generate "contacts+schema.swift"
Expected behavior
no warnings generated
Amplify Framework Version
2.17.1
Amplify Categories
API, DataStore
Dependency manager
Swift PM
Swift version
swift 5
CLI version
12.4.0
Xcode version
14.3.1
Relevant log output
<details><summary>Log Messages</summary>
INSERT LOG MESSAGES HERE
```
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
ios 17
Device
iphone11
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
In order to avoid using the deprecated .id() field when generating the models, in addition to setting the feature flag you need to add the @primaryKey tag to the proper attribute in your schema.
Describe the bug
I'm getting a lot of warnings such as:
For the contacts+schema.swift file generated by CLI command "Amplify codegen models".
There was a prior issue opened related to this -> #2460
and was tracked and partially resolved the "pluralName deprecation" by issue -> #3135. However, the "id" deprecation issue doesn't seem to be resolved.
I tried to set the "respectprimarykeyattributesonconnectionfield" flag in the cli.json file to true and run "Amplify push" and then "Amplify codegen models". but i got the same "'id' is deprecated: Use .primaryKey(fields:)" warning.
I also tried to manually change the "contacts+schema.swift" file, by changing ".id()" to ".primaryKey(fields:)" as the warning suggests. however, i got different errors instead.
Steps To Reproduce
Expected behavior
no warnings generated
Amplify Framework Version
2.17.1
Amplify Categories
API, DataStore
Dependency manager
Swift PM
Swift version
swift 5
CLI version
12.4.0
Xcode version
14.3.1
Relevant log output
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
ios 17
Device
iphone11
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: