Let's take the following example:
enum Gender {
male,
female,
none,
nonBinary,
unspecified
}
type Person @model
(mutations: { create: "newPerson", update: "updatePerson", delete: null } ) {
id: ID!
name: String!
gender: Gender!
}
I would expect this generation to be pretty straight forward, but building this code will generate an error indicating Person is not decodable. Checking the generated definition I can see a Person.swift, Person+Extensions.swift and a Gender.swift file without any extension.
Fixing this issue is simple, basically just add the extension file manually and type in:
extension Gender: Codable { }... But I would imagine this is the responsibility of the code generator to put in place.
Hi @rodrigoelp, support for codable enums just landed in master. We will release Amplify soon along with a new version of the Amplify CLI with the codegen updated. I'll keep this issue open until the release is out.
Has this been fixed yet? I have the same issue in my project at the moment.
Still same issue..
@drochetti When it will be released?
Hey @rodrigoelp @yosuke1985 @AnruStander we just released a stable v1.0.0.
Enums should work correctly in 1.0.0. Can you try and let me know if that fixes the issue for you?
I appreciate your patience and the fact you tried our unstable preview and provided valuable feedback and insights with your issue report. I hope the stable release fixes things for you.
We also have a brand new Discord server for Amplify related topics. Feel free to hit me up there to talk about your use cases and challenges with the new APIs and docs. https://discord.gg/amplify
Closing this issue. Feel free to open a new one if you have problems with the stable version of Amplify.