Amplify-cli: API codegen models iOS: [String] field converted to List<String>?

Created on 19 Dec 2019  路  3Comments  路  Source: aws-amplify/amplify-cli

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

DataStore bug

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ffxsam picture ffxsam  路  3Comments

onlybakam picture onlybakam  路  3Comments

adriatikgashi picture adriatikgashi  路  3Comments

zjullion picture zjullion  路  3Comments

jeanpaulcozzatti picture jeanpaulcozzatti  路  3Comments