I have such type: ``` type Action { id: ID! @uni...
# orm-help
g
I have such type:
Copy code
type Action {
  id: ID! @unique
  title: String!
  date: String!
  description: String
  karma: String!
  executors: String!
  members: [ActionMember!]
  author: User!
}
And I get this error: The relation field
members
has the wrong format:
[ActionMember]
Possible Formats:
ActionMember
,
ActionMember!
,
[ActionMember!]!
Why can't I have
[ActionMember!]
? I want to make this field optional
a
Just write [ActionMember] then?
g
it isn't a possible format 😞
Possible Formats:
ActionMember
,
ActionMember!
,
[ActionMember!]!
a
But [ActionMember!]! Doesn't mean it's required to have a member? Just that it will always return an array and that the children will always be of type ActionMember?
You can still return an empty array
g
Nope,
[ActionMember!]!
means that I should pass an array of `ActionMember`s
a
Which can be empty?
👍 2
g
erm, nope?
!
means that field is required, isn't it?
j
Yes, but
[ ]
is a valid array. It's just empty.
So an array of strings with signature [String!]! can be both
["Hello", "World"]
and
[ ]
.
a
Yes, but in array it doesn't matter :)
It can still be 0 length