new API in preview, bug, code-gen
Describe the bug
[String] field defined on graphql schema gets converted toList<String>? when generating models. List definition is List<ModelType: Model> (as per _Pods/Amplify/List+Model.swift_) so I get Type 'String' does not conform to protocol 'Model' error at build time.
Amplify CLI Version: amplify -v: 4.6.0
Platform target: iOS
To Reproduce
GraphQL schema:
status: [String]
type Task @model {
id: ID!
title: String!
description: String
status: [String]
}
type Note @model {
id: ID!
content: String!
}
Expected behavior
I need to be able to create String arrays (and other primitive types: Int, etc.), not only model arrays/collections.
Related issues: https://github.com/aws-amplify/amplify-ios/issues/257
ModelFieldType doesn't contemplate the possibility of collection of primitive types as per Pods/Amplify/ModelSchema+Definition.swift.
BTW, should this kind of issues be reported to https://github.com/aws-amplify/amplify-ios ?
It is a $ amplify codegen models bug, but it is a specific amplify iOS target issue, so maybe doesn't affects to Javascript/Android implementation.
Hi @Soek22, thanks for reporting this and for providing your feedback and details about the issue. This is a limitation indeed and we're discussing a fix for this.
Most helpful comment
Hi @Soek22, thanks for reporting this and for providing your feedback and details about the issue. This is a limitation indeed and we're discussing a fix for this.