-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
drupalConcerns Drupal backends.Concerns Drupal backends.
Description
Problem
Error:
Missing @default directive for type Page.
Either add a @default directive to Page or turn all occasions of 'Page!' into 'Page'.
(source)
But I want to keep
type Query {
allPages: [Page!]! # <= this occasion of Page non-nullable
page(id: ID!): Page
}
And I don't want to add a default value for the Page
type.
Possible solution 1
Instead, I maybe can do something like this:
type Query {
allPages: [Page!]! @a @b @c @filterNulls
}
where
@a @b @c
are any resolvers returning the list of nullable objects and
@filterNulls
is a new resolver that filters out nulls from the list
Then we can improve the logic of DirectiveInterpreter
to take @filterNulls
into account and ignore this exact type occasion.
Downsides:
- We will invest time
- It will make the
DirectiveInterpreter
code more complicated
Possible solution 2 (already in use)
Do nothing.
type Query {
allPages: [Page]!
}
Metadata
Metadata
Assignees
Labels
drupalConcerns Drupal backends.Concerns Drupal backends.