-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Labels
bugSomething isn't workingSomething isn't workingto-be-reproducedtransferredIssue has been transferred from another Amplify repositoryIssue has been transferred from another Amplify repository
Description
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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingto-be-reproducedtransferredIssue has been transferred from another Amplify repositoryIssue has been transferred from another Amplify repository