List of strings in a model

Hi,
I have written a schema, based on which I want to create a model. Problem is, it has a field which will have a list of strings. But, I am unable to create the model. This is my example schema:

type UserSkills @createModel(
    accountRelation: LIST,
    description: "User skills"
) {
    name: String! @string(maxLength: 255)
    location: String @string(maxLength: 255)
    skills: [String] @list(maxLength: 200)
}

And then I see an error like this:

Error: Missing @string directive on string field skills of object UserSkills

When I add the @string directive to the skills field like this:

type UserSkills @createModel(
    accountRelation: LIST,
    description: "User skills"
) {
    name: String! @string(maxLength: 255)
    location: String @string(maxLength: 255)
    skills: [String @string(maxLength: 255)] @list(maxLength: 200)
}

I see a different error -

✖ Syntax Error: Expected "]", found "@".

Can someone help me?

Hi, both directives need to be defined after the scalar/list type, for example: skills: [String] @string(maxLength: 255) @list(maxLength: 200)

1 Like

Hi, Thanks for the reply. Worked perfectly.