payload
payload copied to clipboard
more type accurate arrays in the GraphQL schema
Description
as discussed in https://github.com/payloadcms/payload/discussions/764
{
slug: "landing",
fields: [
{
name: "cards",
type: "blocks",
blocks: [cards],
required: true,
},
],
}
is outputting
type Landing {
cards: [Landing_Cards]
}
instead of
type Foo {
cards: [Landing_Cards!]!
}
- [x] I have read and understand the CONTRIBUTING.md document in this repository
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
Checklist:
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation
should I just make the union type always non-nullable? is there a case where [null]
will be returned?
Hey @chaoky — good question! There will never be a case where [null]
will be returned, so yes, you can make the union type always non-nullable.
Thank you!
I made every list element non nil, I honestly think that this should be the default in GraphQL, who's is returning [null]
?
Merged! Thank you @chaoky!!!