-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
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
amplify codegen model
generates Swift enum
s that don't conform to Codable
#3299
Comments
What version of Amplify CLI is used to generate the swift code? |
The latest, 4.13.1. See above:
|
This needs changes in Amplify iOS Data store client which is tracked in aws-amplify/amplify-swift#246 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
In the latest version 4.13.1, generated Swift
enum
s don't conform toCodable
. For example:While attempting to build the generated output, the Swift compiler fails with the following errors:
Post
does not conform to protocolDecodable
Post
does not conform to protocolEncodable
Encodable
becausePostKind?
does not conform toEncodable
Expected behavior
The output
enum
should be declared to conform toCodable
. By adding the following lines toamplify/generated/models/PostKind.swift
by hand, the compiler succeeds at synthesizingCodable
implementations forPostKind
, and my project builds correctly:Versions
To Reproduce
Install the CLI, then run
amplify init
,amplify add api
, andamplify codegen model
, then compile the generated code. I chooseios
as the "type of app that you're building".The text was updated successfully, but these errors were encountered: