I think NonNull should be enforced at two locations:
- Here,
required=True should be added:
return DjangoListField(_type, required=True)
- And here,
NonNull() should be added:
super(DjangoListField, self).__init__(List(NonNull(_type)), *args, **kwargs)
This is because:
- When you retrieve the related Set of an object, you never get
None : when no related items are returned, you get an empty Set.
- You never, ever get a Set of
None.
Current implementation causes issues when using third party tools that introspect the schema, like apollo-codegen. (One gets very annoying nested optionals of nested optionals that make no sense and require additional checking).
Hope that makes sense.
(I can do a PR)
I think
NonNullshould be enforced at two locations:required=Trueshould be added:NonNull()should be added:This is because:
None: when no related items are returned, you get an empty Set.None.Current implementation causes issues when using third party tools that introspect the schema, like apollo-codegen. (One gets very annoying nested optionals of nested optionals that make no sense and require additional checking).
Hope that makes sense.
(I can do a PR)