The problem is that, even for required fields, the value of a field might be null.
Counterintuitive, I know.
Suppose you have a model Article, create a bunch of article records, and THEN add a new (required) field.
In this case, the value for such field in already existing records will be null
despite the required
validation. As a consequence, such records will be marked as invalid (in REST API, the is_valid
attribute will be false
, and the UI will show a little red dot next to the record).
The only way to provide non-null GraphQL types would be to have different GraphQL queries that only return valid records, while the current allArticles
queries return both valid and invalid records.
Of course, if we stop returning invalid records on the current queries, we would generate a non-retrocompatible change.
Hope this clarifies the underlying issue