Describe the bug
I run amplify codegen --nodownload to generate API code, with a .yml file which looks like this:
projects:
schema:
schemaPath: schema.graphql
includes:
- graphql/**/*.graphql
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: swift
generatedFileName: aaa.swift
docsFilePath: graphql
region: us-east-2
apiId: null
maxDepth: 20
extensions:
amplify:
version: 3
in the schema.graphql I have some enum type
enum FareMarket {
case1
case2
case3
case4
}
in the generated code it created FareMarket correctly as an enum type but it has this:
public var fareMarket: FareMarket {
get {
return snapshot["fareMarket"]! as! FareMarket
}
set {
snapshot.updateValue(newValue, forKey: "fareMarket")
}
}
which is casting a string type into FareMarket using "as!" and caused a crash.
Steps To Reproduce
run `amplify codegen --nodownload` with the .yml file described above
Expected behavior
It should create the enum using the string value as raw value.
Amplify Framework Version
not sure
Amplify Categories
API
Dependency manager
Swift PM
Swift version
6.1
CLI version
14.0
Xcode version
16.3
Relevant log output
<details>
<summary>Log Messages</summary>
INSERT LOG MESSAGES HERE
</details>
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
18.0
Device
iPhone 16
Specific to simulators
No response
Additional context
No response
Describe the bug
I run
amplify codegen --nodownloadto generate API code, with a .yml file which looks like this:in the
schema.graphqlI have some enum typein the generated code it created
FareMarketcorrectly as an enum type but it has this:which is casting a string type into FareMarket using "as!" and caused a crash.
Steps To Reproduce
Expected behavior
It should create the enum using the string value as raw value.
Amplify Framework Version
not sure
Amplify Categories
API
Dependency manager
Swift PM
Swift version
6.1
CLI version
14.0
Xcode version
16.3
Relevant log output
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
18.0
Device
iPhone 16
Specific to simulators
No response
Additional context
No response