Skip to content

Incorrect codegen error - DataStore does not support 1 to 1 connection with both sides of connection as optional field #505

@anthonymoretti

Description

@anthonymoretti

Describe the bug
Codegen produces the following error even though both sides of the connection are actually non-optional:
"DataStore does not support 1 to 1 connection with both sides of connection as optional field"

To Reproduce

  1. Create the schema below
  2. Add api, push, then run amplify codegen models
  3. See error

Expected behavior
Generates the code

Environment:

  • Amplify Framework Version: 4.21.0
  • Dependency Manager: Cocoapods
  • Swift Version : 5.0

Device Information:

  • Device: Simulator
  • iOS Version: iOS 13.5

Additional context
Schema:

type PhoneCall @model {
  id: ID!
  caller: Person! @connection(name: "PhoneCallCaller")
  callee: Person! @connection(name: "PhoneCallCallee")
  transcript: Transcript! @connection(name: "PhoneCallTranscript")
}

type Person @model {
  id: ID!
  name: String!
  callerOf: [PhoneCall!] @connection(name: "PhoneCallCaller")
  calleeOf: [PhoneCall!] @connection(name: "PhoneCallCallee")
}

type Transcript @model {
  id: ID!
  text: String!
  language: String
  phoneCall: PhoneCall! @connection(name: "PhoneCallTranscript")
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdatastoreIssues related to the DataStore categoryfollow upRequires follow up from maintainers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions