Skip to content

NonNull missing in conversions to DjangoListField #448

Closed
@dperetti

Description

@dperetti

I think NonNull should be enforced at two locations:

  1. Here, required=True should be added:
 return DjangoListField(_type, required=True)
  1. And here, NonNull() should be added:
 super(DjangoListField, self).__init__(List(NonNull(_type)), *args, **kwargs)

This is because:

  1. When you retrieve the related Set of an object, you never get None : when no related items are returned, you get an empty Set.
  2. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions