aws-amplify / aws-amplify/amplify-codegen

“Break” embedded type model fails to compile in Xcode

Open
#495 2 comments 0 reactions 0 assignees View on GitHub
feature-request p4
Dominant language
TypeScript
Stars
59
Forks
64
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

An embedded type model named `Break` fails to compile on Xcode complaining about reserved keywords although the codegen generates code & compiles it successfully.

The build fail error: `Keyword 'break' cannot be used as an identifier here`

Screen Shot 2022-10-17 at 11 26 25 AM

As a fix, tried to add a backtick to the break keyword in the generated files, but still fails complaining about missing parameter:
Screen Shot 2022-10-17 at 11 29 12 AM

### Steps To Reproduce

```swift
Steps to reproduce the behavior:
1. Create an embedded type model named "Break", like:
`type Break {
break_id: Int
payment_mode: String
}`
2. generate models through `amplify codegen models` & observe logs that indicate successful codegenearation
3. Now, try to build the app on Xcode & see how it fails
4. Try adding `backtick` as a workaround but still fails complaining about the missing parameter
```

### Expected behavior

scenario 1: `amplify codegen models` successfully generates codegenerated files & code builds on Xcode (after a potential bug-fix)

scenario 2: `amplify codegen models` throws error on the CLI to consider renaming embedded types in their schemas to avoid usage of the reserved keywords on Xcode

### Amplify Framework Version

main

### Amplify Categories

DataStore

### Dependency manager

Cocoapods

### Swift version

5.0

### CLI version

9.1.0

### Xcode version

14.0.1

### Relevant log output

```shell

Log Messages

INSERT LOG MESSAGES HERE
```

```

### Is this a regression?

No

### Regression additional context

_No response_

### Device

iPhone 14 pro

### iOS Version

iOS 16

### Specific to simulators

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.